VSFlexGrid Control > VSFlexGrid Properties, Events, and Methods > VSFlexGrid Properties > EditText Property |
Returns or sets the text in the cell editor.
[form!]VSFlexGrid.EditText[ = value As String ]
The EditText property allows you to read and modify the contents of the cell editor while it is active.
This property is useful mainly for handling the ValidateEdit event. When ValidateEdit event is fired, the cell still contains the original value. The new (edited) value is available only through the EditText property.
For example, the code below shows a typical handler for the ValidateEdit event. In this case, column 1 only accepts strings, and column 2 only accepts numbers greater than zero:
Sub fg_ValidateEdit(ByVal Row As Long, ByVal Col As Long, Cancel As Boolean)
Dim c$
' different validation rules for each column
Select Case Col
Case 1 ' column 1 only accepts strings
c = Left$(fg.EditText, 1)
If UCaseS(c) < "A" And UCase$(c) > "Z" Then
Beep: Cancel = True
End If
Case 2 ' column 2 only accepts numbers > 0
If Val(fg.EditText) <= 0 Then
Beep: Cancel = True
End If
End Select
End Sub
String