Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make a Combo Box Read Only

Status
Not open for further replies.

Wilsond3010

Programmer
Jan 23, 2001
4
GB
Can anyone help.

I trying to read a combo box values from a file.

But how do I make the inital text value. But also make it so they cannot type into the field.

And have to choose from the drop down list.


 
To set the initial value, providing there is something in the combo box, set the ListIndex property to 0 (for the first element in the list). If there is nothing in the list, then setting ListIndex to 0 will give an error, so you will have to check ListCount>0 first. E.G.

If Combo1.ListCount>0 Then
Combo1.ListIndex = 0
Else
Combo1.ListIndex = -1
End If

Simon
 
Thanks for your help.

I've managed to fix the problem. I had to keep the combo as a type 0 since I want to be able to populate the combo.text with a value.

And had to add some code to say if the keypress wasn't a up or down cursor to lock the combo text area.
 
Wilsond3010,

Does the Locked Property on the Combo box work to make it read only ?

- Subha Nothing is impossible, even the word impossible says I'm possible.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top