Disable item in combobox

  • Thread starter Thread starter Peter Pantus
  • Start date Start date
P

Peter Pantus

Hi,

Is it possible in a combox to disable one item so the user see the item but
does not can select the item??

Thanks
 
Hi Peter

Out of interest, why do you want to do this? I don't know of a way of doing
this exactly but you could check the chosen value and reject it if it's the
wrong one.

For example, assume combobox1 has three values "Tom", "Dick", "Harry" and
that you don't want the user to be able to choose "Dick"

Private Sub ComboBox1_Change()
If (ComboBox1.Value = "Dick") Then
MsgBox ("Dick is not a valid selection")
ComboBox1.ListIndex = -1
End If
End Sub

This way the user can choose any value (including Dick) buts gets shown a
message when Dick's chosen saying "not valid" and the listindex is set to -1
(i.e. no item chosen)

Hope this helps

David
 
Thanks David
That is exaclty what I want
It is too complicate too explane why I want to do this
 
Back
Top