Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
394
Get Value of Editor when IsValid is False
posted

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

 

            ' If this control is used as an Editor, then it means the Text property

            ' is not used.

            If pvEditor IsNot Nothing Then

                pvEditor.Value = value

            End If

        End Set

    End Property