-
Hi,
I think this question might have been asked before but i would like to have solution to this.
How can we align a text in Combo Box like Center,Left,Right similar to that in textbox.Can anyone tell give me solution to this???
Any help will be highly appreciated
Regards
-
Since there is no alignment property in a combo box, you'll have to fake it. Do that using the SPACE function, like so...
Code:
' This routine forces the items in the Combo Box to right-alignment
' You can use the same kind of idea to force center-alignment
'
cboMyCombo.Clear
cboMyCombo.AddItem SPACE(30-Len("Washington")) & "Washington"
cboMyCombo.AddItem SPACE(30-Len("Lincoln")) & "Lincoln"
cboMyCombo.AddItem SPACE(30-Len("Roosevelt")) & "Roosevelt"
'
I haven't tried this, so you might have to go to a non-proportional font (like Courier) to get the results you want. The "30" in the code refers to a maximum possible length of Presidential names.