Radio Button problem

raviinfosys77

New member
Joined
May 25, 2011
Messages
1
Location
Mumbai
Programming Experience
1-3
I have a sample file in which it has a browse button, a checkedlistbox, and two radio buttons. You can see the screen-shot below.

Sample.JPG

Whenever I click on the browse button.... the PDF files are shown in the checked list box.

Here is the code behind the browse button

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Browse.Click
Dim f As New FolderBrowserDialog
f.ShowDialog()
If f.SelectedPath = "" Then Exit Sub
Inputbox.Text = f.SelectedPath
If Inputbox.Text.Length = 0 Then Exit Sub
For Each File As String In Directory.GetFiles(Inputbox.Text)
If File.ToLower.EndsWith(".pdf") Then
CheckedListBox1.Items.Add(File)
End If
Next
End Sub

But I have to make one more option ... I cant figure out how to make it....???

The problem is that there are two radio buttons named Select All and Select none respectively.

I have to write a code so that whenever the select all option is selected... All files in the checkedlistbox should be selected.....

and whenever the Select none option is selected... Al the files in the checkedlistbox should be deselected....

that's the case ... I just cant figure out how to do this since I am new to VB.NET....

Thanks in advance.....
 
Give these a go:

VB.NET:
'Select All
For i = 0 To CheckedListBox1.Items.Count - 1
    CheckedListBox1.SetItemChecked(i, True)
Next

'Unselect All
For i = 0 To CheckedListBox1.Items.Count - 1
    CheckedListBox1.SetItemChecked(i, False)
Next
 
Back
Top