Question how can i convert string to font?

yolanasareth

New member
Joined
Nov 30, 2011
Messages
2
Programming Experience
Beginner
can anybody help me? i can't convert string to font.

this is my source code..


Try
For Each x As FontFamily In FontFamily.Families
lstFont.Items.Add(x.Name)
Next
lstFont.SelectedItem = "Times New Roman"
LstSize.SelectedIndex = 6
Catch ex As Exception

End Try


Private Sub lstFont_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstFont.SelectedIndexChanged //LIST FONT

txtServeSend.Font = New System.Drawing.Font(lstFont.SelectedItem.ToString, 12, FontStyle.Regular)

End Sub



Private Sub LstSize_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles LstSize.SelectedIndexChanged //LIST SIZE

txtServeSend.Font = New System.Drawing.Font(lstFont.SelectedItem.ToString, LstSize.SelectedItem, FontStyle.Regular)

End Sub

when i set font in textbox success but i want to display in richtextbox.
error list : value of type 'system.drawing.font' cannot be converted to string.

anybody help me? thank you
 
error list : value of type 'system.drawing.font' cannot be converted to string.

how can i convert string to font? i cant sent properties font.
 
Read the error message. You are asking how to convert a String to a Font but the error message says that the problem is that you're trying to convert a Font to a String, which is the complete opposite. Nowhere in the code you posted is a Font being converted to a String, which I already said in my previous post. I will say again and for the last time, show us the actual code that causes the error. If you refuse to show it to us then we can't help you fix it.
 
Back
Top