Hii I am desigining one VB project like dis..

VB application to change the font of the textbox... use the controls list box for the fontname, check box for Effects , combo box for sixe, combo box for color, and option button for font style....

I have written the code for loding font names and font sizes in a list box... but i am unable to get rest of the things.. please help me regarding this.... thank you....

Private Sub Form_Load()
For i = 0 To Screen.FontCount - 1
List1.AddItem Screen.Fonts(i)
Next i
End Sub
Private Sub List1_Click()
End Sub

Private Sub LoadFontSizes()
Dim SaveName As String
Dim SaveSize As Single
Dim Sizes As Variant
Dim i As Long
'place holders for font name and font size
SaveName = cboFontSize.Font.Name
SaveSize = cboFontSize.Font.Size
Sizes = Array(6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72)
'this is the font the user has selected
cboFontSize.FontName = List1.Text
'whip through the array checking all possible font sizes
For i = LBound(Sizes) To UBound(Sizes)
cboFontSize.FontSize = CLng(Sizes(i))
'font supports this size, add to combo
If cboFontSize.FontSize = CLng(Sizes(i)) Then
cboFontSize.AddItem Sizes(i)
End If
cboFontSize.FontName = SaveName
cboFontSize.FontSize = SaveSize
End Sub

Edited by WaltP: Added CODE Tags

6 Years
Discussion Span
Last Post by vb5prgrmr

Hi somyraj,
What is that rest of the things you want? Do you mean to say you cant get Underline, Bold, Italic etc? If so then use

vbUnderline = True
vbItalic = True
vbBold = True


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.