I have a form with a button which is disabled by default, and a CheckedListBox with 68 items in it. What is the simplest way of enabling the button, when an item in the CheckedListBox is selected or unselected?
I’m looking for something like
If CheckedListBox1…any of the items state changes…Then
Button1.Enabled = True
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load For i As Integer = 1 To 5 CheckedListBox1.Items.Add(i) Next CheckedListBox1.CheckOnClick = True 'Checked item when you select it End Sub Private Sub CheckedListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckedListBox1.SelectedIndexChanged If CheckedListBox1.SelectedItem.ToString = "1" Then Button1.Enabled = True End If End Sub
Edited 4 Years Ago by Jx_Man: n/a
Thanks for your reply.
This is only working for items 1 to 5, but I don’t want them because like I said, I already have my own 68 items in the CheckedListBox which I added through the designer. Also CheckOnClick was not necessary because I already have that as “True” from the properties in designer. So this is only working for items 1 to 5 and not for my own 68 items.
Also CheckOnClick was not necessary because I already have that as “True” from the properties in designer.
Okay. I don't know it if you already set it.
So this is only working for items 1 to 5 and not for my own 68 items.
Yes, This only working for items with value 1 to 5. I just give the example. You modified it as you wish.
So you are saying that here
For i As Integer = 1 To 5
I have to manually specify 68 different names/items?
But I already have them in the designer. Isn't there a way to go through them regardless of their names, and see if their state has changed? Names must be specified in the code?
you can use this code at the click event of the listbox
Thanks for providing the simplest way of doing this :)
Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...
Hi. so this is actually a continuation from another question of mineHere but i was advised to start a new thread as the original question was already answered.
This is the result of previous question answered :
code for the listbox - datagridview interaction
At the top of the code ...
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...