I am building a word pad clone with extra a few extra features. I am trying to get two combo boxes (one with font names, the other with font sizes) to apply their selected attribute to the selected text in a richtextbox. This was my latest attempt, and I think I'm starting to get close, but I still get an error for InvalidCastException - Conversion from string "" to type 'Integer' is not valid.
Private Sub FontToolStripComboBox_DropDownClosed(ByVal sender As Object, ByVal e As System.EventArgs) Handles FontToolStripComboBox.DropDownClosed
Dim ComboFonts As System.Drawing.Font
ComboFonts = Pad.SelectionFont
Pad.SelectionFont = New System.Drawing.Font(ComboFonts.Name(FontToolStripComboBox.SelectedText), Font.Size, Font.Style) '<--- this line is giving the exception for the FontToolStripComboBox.SelectedText entry'
End Sub
I can't figure out how to use the string in the combobox with the font name to actually change the font to that name.