I would like to get the current Text entered in a Grid cell when the Editor's IsValid property is returning False.
I am inheriting the UltraTextEditor and I want to retrieve the current text entered during Edit mode from the Editor. I am using the current code to shadow the Text property so that if an Editor is passed in then rather than retrieving the Text property from the base UltraTextEditor, I want to get the current value from pvEditor. If pvEditor.IsValid is returning False then the exception is thrown telling me I cannot get Value. Is there a way to get the text that is causing the IsValid to fail? I can get TextLength, but no string :o(
Private Shadows Property Text(ByVal pvEditor As Infragistics.Win.EmbeddableEditorBase) As String
Get
Dim currentText As String = MyBase.Text
' If this control is used as an Editor, then it means the Text property
' is not set.
If pvEditor IsNot Nothing _
AndAlso pvEditor.IsValid Then
currentText = CStr(pvEditor.Value)
End If
Return currentText
End Get
Set(ByVal value As String)
MyBase.Text = value
' is not used.
If pvEditor IsNot Nothing Then
pvEditor.Value = value
End Set
End Property
Fantastic! I feel so stupid for not spotting that property!
When an editor's IsValid property returns false, you can use the EmbeddableEditorBase.CurrentEditText property to get the value.
Try the Text property of the cell.