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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hover and gray out an item in a drop down list

Status
Not open for further replies.

trk1616b

MIS
May 25, 2005
20
0
0
US
2 Questions...

1- i want to hover over a text box and diplay a string. I can't figure out how to do this in .NET.

2- is there a way to 'dither' and item in a combo box? Basically, i have 3 items in my list, and i want to be able to select 2 of them, but I want the 3rd to be displayed, but 'grayed out' so they cannot select it. Any way to do this?

Thanks in advance.
 
1. Consider ToolTip class
2.
private mintSelectedIndex as integer

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged

dim MyNonSelectableIndex as integer

If ComboBox1.SelectedIndex = MyNonSelectableIndex Then
ComboBox1.SelectedIndex = mintSelectedIndex
End If
End Sub

Private Sub ComboBox1_DropDown(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.DropDown
mintSelectedIndex = ComboBox1.SelectedIndex
End Sub
 
Assign some index to MyNonSelectableIndex
 
You say "drop down list," which if you mean DropDownList, that's an ASP control. ComboBox is the term for Windows Forms. So which is it, Windows or WebForms? If it's WebForms, you should ask this in the ASP.Net forum instead. Regardless, if it's Windows Forms, you can owner draw the combobox and draw your item and background with colors you choose. If it's Web Forms, there are ways to color items, which you will have to do a search or ask in the other forum. I have seen examples, but don't know off the top of my head since I'm not a web guy.
 
RiverGuy,

I have an impression that trk1616b is not interested in the color per say but in the way of disabling the item. Since in Windows, unavailable item is usually greyed out, he/she uses this attribute as the sign of the item unavailability.

vladk

 
Right, but if there is no way to do this by default, it has to be "faked
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top