RadTextBox Focusable and ReadOnly not working in code

3 posts, 0 answers
  1. NORIS
    NORIS avatar
    29 posts
    Member since:
    Jun 2009

    Posted 21 Dec 2009 Link to this post

    Hello,
    I have the two following routines.  They are both finding the control and the correct toggle state, however the .Focusable, .ReadOnly and .Focus on the RadTexBox are not changing.  .Focusable, .ReadOnly display that they have changed, but .Focus does not.
    Why is this?
    Thanks.

     

    Private Sub SRSOther_ToggleStateChanged(ByVal sender As System.Object, ByVal args As Telerik.WinControls.UI.StateChangedEventArgs) Handles SRSOther.ToggleStateChanged 

     

    Dim txt As RadTextBox = Nothing

     

     

     

    Dim ICon As System.Windows.Forms.Control.ControlCollection = PersonTabStrip.SuspectList.Item(CInt(SusNum)).Controls

     

     

     

    For Each cont As Control In ICon

     

     

     

    If cont.Name.StartsWith("SgrpSResident") Then 'get textbox from group controls

     

     

     

    Dim theGrpBox As RadGroupBox = DirectCast(cont, RadGroupBox)

     

     

     

    For Each Gctrl As Control In theGrpBox.Controls

     

     

     

    If Gctrl.Name.StartsWith("SRSOtherTxt") Then

     

     

     

    txt = DirectCast(Gctrl, RadTextBox)

     

     

     MsgBox(txt.Name)

     

    If args.ToggleState = Telerik.WinControls.Enumerations.ToggleState.On Then

     

     

     

    txt.Focusable = True

     

     

     

    txt.ReadOnly = False

     

     

     

    txt.Focus()

     

    MsgBox(

    "Toggle On, focusable=" & txt.Focusable & " readonly=" & txt.ReadOnly & " focused=" & txt.Focused)

     

     

     

    ElseIf args.ToggleState = Telerik.WinControls.Enumerations.ToggleState.Off Then

     

     

     

    txt.Focusable = False

     

     

     

    txt.ReadOnly = True

     

     

     

    txt.Text = ""

     

     

     

    MsgBox("Toggle Off")

     

     

     

    End If

     

     

     

    Exit For

     

     

     

    End If

     

     

     

    Next

     

     

     

    End If

     

     

     

    Next

     

     

     

    End Sub 'SRSOther_ToggleStateChanged

     

     

     

     

     

     

    Private Sub SCatOther_ToggleStateChanged(ByVal sender As System.Object, ByVal args As Telerik.WinControls.UI.StateChangedEventArgs) Handles SCatOther.ToggleStateChanged

     

     

     

    Dim ICon As System.Windows.Forms.Control.ControlCollection = PersonTabStrip.SuspectList.Item(CInt(SusNum)).Controls

     

     

     

    For Each cont As Control In ICon

     

     

     

    If cont.Name.StartsWith("SCatOtherTxt") Then 'get textbox from group controls

     

     

     

    MsgBox(cont.Name & " type=" & cont.GetType.ToString)

     

     

     

    Dim txt As RadTextBox = DirectCast(cont, RadTextBox)

     

     

     

    If args.ToggleState = Telerik.WinControls.Enumerations.ToggleState.On Then

     

     

     

    txt.Focusable = True

     

     

     

    txt.ReadOnly = False

     

     

     

    txt.Focus()

     

    MsgBox(

    "Toggle On")

     

     

     

    Else

     

     

     

    txt.Focusable = False

     

     

     

    txt.ReadOnly = True

     

     

     

    txt.Text = ""

     

     

     

    End If

     

     

     

    Exit For

     

     

     

    End If

     

     

     

    Next

     

     

     

    End Sub 'SCatOther_ToggleStateChanged

     

     

     

     

  2. NORIS
    NORIS avatar
    29 posts
    Member since:
    Jun 2009

    Posted 22 Dec 2009 Link to this post

    Sorry, my bad.  I had the RadTextBox set to Enable = False.  I changed to True and it's working fine.
    Hope you haven't taken time to work on this yet.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 23 Dec 2009 Link to this post

    Hello NORIS,

    I am glad to hear that you found the reason for your issue.

    If you have additional questions, feel free to contact me.

    Kind regards,
    Nikolay
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top