|
-
May 6th, 2004, 08:47 AM
#1
Thread Starter
Hyperactive Member
listbox
Is it possible to disable(do not want user to select it for some special case) one of the items in a listbox?
-
May 7th, 2004, 04:58 AM
#2
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.
-
May 7th, 2004, 07:23 AM
#3
Thread Starter
Hyperactive Member
thank you. I will give it a shot.
-
May 7th, 2004, 07:57 AM
#4
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|