MattAllen
asked on
Disable options in a list box!!
Hey experts,
I have a list box with a series of options but i want to be able to disable some of these options as they are not available, hence stopping the user selecting this option...how do i do this!
Thanks in advance people
Matt
I have a list box with a series of options but i want to be able to disable some of these options as they are not available, hence stopping the user selecting this option...how do i do this!
Thanks in advance people
Matt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Cheers fellas,
i needed a msgbox to come up ideally to tell the user becasue it is only a demo version of the software but thanks a lot guys
Matt
i needed a msgbox to come up ideally to tell the user becasue it is only a demo version of the software but thanks a lot guys
Matt
Here is an example.
Open a New VB Standard Exe Application. In Form1 add a listview control (ListView1) and add the following code to Form1:
Option Explicit
Private Sub Form_Load()
Dim i As Long
ListView1.View = lvwList
ListView1.Checkboxes = True
ListView1.LabelEdit = lvwManual
For i = 0 To 19
ListView1.ListItems.Add , , "Item " & i
Next
ListView1.ListItems(3).For
End Sub
Private Sub ListView1_ItemCheck(ByVal Item As MSComctlLib.ListItem)
If Item.ForeColor = vbGrayText Then 'If disabled...
Item.Checked = False '... Reset checkbox
End If
End Sub