|
-
Jul 30th, 2003, 03:24 AM
#1
Thread Starter
Fanatic Member
How to determine selected items in Check list box?
I having trouble with recognizing selected items in Check List Box.
For example, I want the following code to print the only non selected items in a file. However the line "If Not chkToDo.Items.Item(j).checked Then" is not working. In fact, I don't find any drop down after Item(). - I'm only getting GetType().
Can anyone show light??
Thanx
Public Sub WriteToDoInFile()
'write to do unchecked lists in file
Dim i, j As Integer
i = chkToDo.Items.Count
Try
FileOpen(2, "ToDo.txt", OpenMode.Output)
For j = 0 To i - 1
If Not chkToDo.Items.Item(j).checked Then
Print(2, chkToDo.Items.Item(j) & vbCrLf)
End If
Next
FileClose(2)
Catch x As System.Exception
MessageBox.Show(x.ToString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Life is a one way journey, not a destination. Travel it with a smile and never regret anything.
Yesterday is history, tomorrow is a mystery, today is gift - that's why we call it present.
-
Jul 30th, 2003, 04:28 AM
#2
you mean this :
VB Code:
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
Dim x As Integer, i As Integer
For x = 0 To CheckedListBox1.Items.Count - 1
i = CheckedListBox1.GetItemCheckState(x)
If Not i = 1 Then
'/// it's not checked , so do stuff
Else
MessageBox.Show(CheckedListBox1.Items(x) & " :this is checked!")
End If
Next
End Sub
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|