This is a migrated thread and some comments may be shown as answers.

RadTextBox Focusable and ReadOnly not working in code

2 Answers 211 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
NORIS
Top achievements
Rank 1
NORIS asked on 21 Dec 2009, 07:49 PM
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 Answers, 1 is accepted

Sort by
0
NORIS
Top achievements
Rank 1
answered on 22 Dec 2009, 04:40 PM
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.
0
Nikolay
Telerik team
answered on 23 Dec 2009, 04:33 PM
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.
Tags
TextBox
Asked by
NORIS
Top achievements
Rank 1
Answers by
NORIS
Top achievements
Rank 1
Nikolay
Telerik team
Share this question
or