i want to disable checkboxes according to textbox text
For example --- if i enter 1,4 in textbox then checkbox1 and checkbox4 will be disabled and even after that when i type 2,3 in textbox then checkbox2 and checkbox3 will be disabled and checkbox1 and checkbox4 will be enabled again ...
Remember : i wanna use this coding with unlimited no. of checkboxes...
How to do this ?
The code mentioned below can checked according to textbox text --but i want to disabled ony not checked ....
Protected Sub TextChanged(ByVal sender As Object, ByVal e As EventArgs) Handles MyTextBox.TextChanged
Dim separator As Char = ","c Dim allIIDs As New List(Of String)
If MyTextBox.Text.Length <> 0 Then
For Each strNum As String In MyTextBox.Text.Split(separator)
Dim num As Int32 If Int32.TryParse(strNum, num) Then allIIDs.Add(strNum)
End If
Next
End If allIIDs.Sort() For Each control As Control In UpdatePanel1.Controls
If TypeOf control Is CheckBox
Then
Dim chk As CheckBox = DirectCast(control, CheckBox) chk.Checked = allIIDs.BinarySearch(chk.Text) > -1
End If
Next
End Sub
!--removed tag-->
No one has replied yet! Why not be the first?
Sign in or Join us (it's free).