Results 1 to 4 of 4

Thread: listbox

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Posts
    471

    listbox

    Is it possible to disable(do not want user to select it for some special case) one of the items in a listbox?

  2. #2
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682
    You could put some code in the SelectedIndexChanged() event of the listbox and query the index that the user selected, then allow / disallow selection as needed.
    I don't live here any more.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Posts
    471
    thank you. I will give it a shot.

  4. #4
    Addicted Member
    Join Date
    Aug 2002
    Posts
    224
    Hi,

    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged

    With ListBox1
    Select Case .SelectedIndex
    Case 2, 4
    .SelectedIndex = -1
    End Select
    End With
    'Another way ************************
    ' With ListBox1
    ' Select Case .SelectedIndex
    ' Case 2, 4
    ' .SelectedIndex -= 1
    'End Select
    'End With

    End Sub

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