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!

Resize combo box with mousedown event

Status
Not open for further replies.

mguidry5

Technical User
Jan 11, 2005
91
US
Hey there,

I'm trying to resize a combo box with a mousedown event. The combo box has two columns, VendorID and VendorName. The VendorID is an autonumber, and therefore meaningless to the user. The autonumber is bound, so I'm using an unbound text box to hold the vendor name. What I'd like to do is make the combo box very small until the user clicks on the arrow, then allow it to grow in width so the vendor name can be seen for ease of selection, then reduce the width again so only the autonumber will be seen in the combo box, and the vendor name will be seen in the text field.

When I change the width property of the combo box on the mousedown event, I can no longer make a selection in the combo box. What gives? Here's my code:
Code:
Private Sub cboTrans1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.cboTrans1.Width = 5000
End Sub
thanks,
Mike
 
Why would you need both objects? In your combo box, set the column widths to 0";1" (or whatever you need for the 2nd column). By doing so, the autonumber column, that the user has no use for, is never even seen and your vendor name is visible at all times.


Randy
 
. . . and in design view you can reduce the the width of the combobox until only the arrow shows. This has no affect on the column widths! . . . .

Calvin.gif
See Ya! . . . . . .
 
Thanks, guys. Randy - I smell what you're steppin' in, but I'm still curious as to why my mousedown event interupts the selection of an item from the combo box.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top