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