|
-
Oct 15th, 2004, 11:54 PM
#1
Thread Starter
Addicted Member
checkedlistbox
Hi,
Could you I set the item in checkedlistbox is ticked?
Thanks,
NewBie
-
Oct 16th, 2004, 12:30 AM
#2
New Member
not sure I get your question. The checklistbox has a ItemCheck Event that you could put your code into it.
Example below:
Private Sub clbAnchoring_ItemCheck(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemCheckEventArgs) Handles clbAnchoring.ItemCheck
'fire when the check box checked
mTxtBox.Anchor = AnchorStyles.None
Dim obj As Object
'Iterate through the checked items
For Each obj In clbAnchoring.CheckedItems
'AnchorStyles cannot be combined
'new value and old value are both combined
mTxtBox.Anchor = mTxtBox.Anchor Or _
DirectCast(obj, AnchorStyles)
Next
'If an items was just checked, it won't
'be in the checkeditmes yet
If e.NewValue = CheckState.Checked Then
mTxtBox.Anchor = mTxtBox.Anchor Or _
DirectCast(clbAnchoring.Items(e.Index), AnchorStyles)
'If an items was just unchecked, remove
'that AnchorStyles
ElseIf e.NewValue = CheckState.Unchecked Then
mTxtBox.Anchor = mTxtBox.Anchor And Not _
DirectCast(clbAnchoring.Items(e.Index), AnchorStyles)
End If
End Sub
-
Oct 16th, 2004, 12:42 AM
#3
Thread Starter
Addicted Member
Thanks for your Reply
NewBie
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
|