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!

combo box "dropup" event

Status
Not open for further replies.

bartvb

Programmer
Nov 29, 2001
24
0
0
BE

I made the following :

I change the font in a combo box when the users "dropdowns" to "courrier". (because all the letters have the same width) But i want to change it again to the normal font when the user selects an item.

(i can't place it in the click event because when you then type 1 letter; the dropdown list already disapears)


* form with combo box ( sorted = true / style = 2 -dropdown list)

'*******************************'
Dim FontDropDown As New StdFont
Dim FontNormal As New StdFont

Private Sub Combo1_DropDown()
Combo1.Font = FontDropDown
End Sub

Private Sub Form_Load()
With FontDropDown
.Bold = True
.Name = "Courier New"
.Size = 8
End With

With FontNormal
.Bold = True
.Name = "MS Sans Serif"
.Size = 8
End With

Combo1.AddItem ("abb " & "text1")
Combo1.AddItem ("abc " & "text2")
Combo1.AddItem ("dee " & "text3")
Combo1.AddItem ("def " & "text4")
Combo1.AddItem ("ghi " & "text5")

End Sub

'*******************************'

 
what do you mean it already disappears ???

TRYP
 
(make sure the sorted property is true)
Run the example above:

click on the arrow of the combo box and press "def"

----------------------------------------
Add the following code and do the same => you will notice the difference...

Private Sub Combo1_Click()
Combo1.Font = FontNormal
End Sub
 
i loaded the code
1 font to begin with
then i dropdown (now its courier)
now i click a selection
now im back to the first font

if i drop down again i get courier again
if i type "def" i get the "dee text3" choice in the first font


am I missing something ??

tryp


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top