Results 1 to 3 of 3

Thread: checkedlistbox

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2004
    Posts
    151

    checkedlistbox

    Hi,

    Could you I set the item in checkedlistbox is ticked?

    Thanks,
    NewBie

  2. #2
    New Member
    Join Date
    Sep 2004
    Location
    Orange
    Posts
    14
    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

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 2004
    Posts
    151
    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
  •  



Click Here to Expand Forum to Full Width