General discussion

Locked

ComboBox in Visual Basic

By shariqsaad ·
How can i display different fonts in the combo box with their font style displaying accordingly at each index when the user click the ComboBox at runtime ?

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

ComboBox in Visual Basic

by amanabala In reply to ComboBox in Visual Basic

Hi,
This code assumes a form (form1) with a combo box(combo1) and a text box (text1).
Whenever the text in combo box changes, the font changes and the new text is displayed in the text box.

If you need further assitance, please let me know

-Ravi<ananth_manabala@yahoo.com>

'Form General Code block

Dim fonts(5) As String

Private Sub Combo1_Click()
Dim i As Integer
i = Combo1.ListIndex
Text1.Text = fonts(i)
Combo1.FontName = fonts(i)
End Sub

Private Sub Form_Load()
fonts(0) = "MS Sans Serif"
fonts(1) = "Arial"
fonts(2) = "Tahoma"
fonts(3) = "Verdana"
fonts(4) = "Times New Roman"
End Sub

Collapse -

ComboBox in Visual Basic

by shariqsaad In reply to ComboBox in Visual Basic

My problem is that i dont want any text fields just one combo box that's it.
The combo box entries should be displayed in the respected font types.
i anyone can help me than please do.

Collapse -

ComboBox in Visual Basic

by amanabala In reply to ComboBox in Visual Basic

Dear Shariqsaad,

The textbox in the example I sent you was to display the result of the code, it was not necessary: You can remove the text box and the code to write to the text box. I can send you the code by email if you would like.
regards,
Ravi

Collapse -

ComboBox in Visual Basic

by shariqsaad In reply to ComboBox in Visual Basic

Dear Ravi,
When I change one font all the fonts in the combo box also change their fontstyle which i dont want to happen.
i want every font listed in the combo box to appear in its own fontstyle when i open the combo box.

Collapse -

ComboBox in Visual Basic

by shariqsaad In reply to ComboBox in Visual Basic

This question was closed by the author

Back to Web Development Forum
5 total posts (Page 1 of 1)  

Related Forums