You are not logged in.
This forum has been archived and no longer accepts new user registrations. Please report your questions, problems, and feedback to the issue page of ReoGrid on GitHub. Thank you for your cooperation.
Hello Jing,
I have question about this CellFormatFlag.. Does this just let numbers only with copy and paste?
i have this code to only let me use numbers only? or do still need it for what i am trying to do?
Also, How do you use DrawToBitmap function? does make image of what is the highlighted area or selected range?
Private Sub rgMainControl_BeforePaste(sender As Object, e As BeforeRangeOperationEventArgs) Handles rgMainControl.BeforePaste
Dim data(,) As Object
Dim range As ReoGridRange
'WorkSheet Settings
'Checks to see if the paste is numeric or alpha
With rgMainControl
data = RGUtility.ParseTabbedString(Clipboard.GetText)
range = New ReoGridRange(.SelectionRange.Row, .SelectionRange.Col, data.GetLength(0), data.GetLength(1))
For i As Integer = 0 To data.GetLength(0) - 1
For j As Integer = 0 To data.GetLength(1) - 1
If Not IsNumeric(data(i, j)) Then
e.IsCancelled = True
data(i, j) = Nothing
End If
Next
Next
End With
'WorkBook Settings
With rgMainControlContainer
.DoAction(New SetRangeDataAction(range, data))
End With
End Sub
and this checks also if the cell data is number also
Private Sub rgMainControl_CellDataChanged(sender As Object, e As CellEventArgs) Handles rgMainControl.CellDataChanged
'Checks to see if the create the grid and if so exit the sub.
If m_blnSetup Then Exit Sub
'checks to see what row if the rows are 0 or 1 and exit the sub
If e.Cell.Row = 0 Then Exit Sub
'Checks to see if values in the cell are numeric and also all cells are filled.
With rgMainControl
If e.Cell.Column = (.ColumnCount - 1) Then
If Not .Cells(e.Cell.Row, (.ColumnCount - 1)).Data Is Nothing Then
If IsNumeric(.Cells(e.Cell.Row, (.ColumnCount - 1)).Data.ToString) Then
dtFactorData.Rows((e.Cell.Row - 1))("GreenYData") = CDbl(.Cells(e.Cell.Row, (.ColumnCount - 1)).Data.ToString)
End If
End If
End If
End With
'Checks to see if the can enable the next button
Call CheckDataCompletion()
End Sub
Offline
Hi, CellDataFormatFlag is only used for cell display format, it cannot be used to validate the cell data. But I think the data validation would be useful, it's possible to make another feature that is similar as the 'Data Validation' in Excel available from next version (the 0.8.8.3 will be a maintaining release, this might be available from 0.8.8.4).
I just found that DrawToBitmap method doesn't work properly; It will be fixed from next release, and I will try to implement the feature that can render specified range.
Offline
Hello Jing,
Thank you.. I will wait for you maintenance release.. That would be good idea if you add data validation into the control, Even though the code works good.. I think would be little easier because you can have it handle everything..
Shane
Offline