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()
LoadFontSizes
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)
cboFontSize.Clear
'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
Next
cboFontSize.FontName = SaveName
cboFontSize.FontSize = SaveSize
End Sub

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

Thankx

Once again, I suggest the use of the common dialog control for showfont, showcolor...

Good Luck

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.