Font & Size change from Combo Box - Tutorial
Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
2 posts
Page 1 of 1
Hello guys,
Here I present my new tutorial!!
Hope you like it!!!
cooll;
This tutorial will teach you how to change text fonts and sizes using combo boxes and apply them in a Rich Text Box.
1. First open up VB.NET and then create a new Windows Forms Application.
2. After the project loads, add 2 Combo boxes and 1 Rich Text Box on to the Form from the Tool Box.
3. Arrange those controls in such a way that the 2 combo boxes are above the Rich Text Box.
4. Double click anywhere on the Form except on the Rich Text Box and the combo boxes.
5. Add these items to ComboBox2 by going to its properties and clicking the small button next to Items in its properties -
8
9
10
11
12
14
16
18
20
22
24
26
28
36
48
72
6. Add this code to the Form1_Load event
Hope you liked it!!!
If you like my tutorials please give me +rep
cooll;
Here are the project files
Here I present my new tutorial!!

Hope you like it!!!

This tutorial will teach you how to change text fonts and sizes using combo boxes and apply them in a Rich Text Box.
1. First open up VB.NET and then create a new Windows Forms Application.
2. After the project loads, add 2 Combo boxes and 1 Rich Text Box on to the Form from the Tool Box.
3. Arrange those controls in such a way that the 2 combo boxes are above the Rich Text Box.
4. Double click anywhere on the Form except on the Rich Text Box and the combo boxes.
5. Add these items to ComboBox2 by going to its properties and clicking the small button next to Items in its properties -
8
9
10
11
12
14
16
18
20
22
24
26
28
36
48
72
6. Add this code to the Form1_Load event
Code: Select all
7. Now add this code above End Class but below End Sub
ComboBox2.Text = "10"
For fontf As Integer = 0 To FontFamily.Families.Length - 1
ComboBox1.Items.Add(FontFamily.Families(fontf).Name)
Next
Code: Select all
And now you can change the font and its size using combo boxes!!! Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Try
RichTextBox1.SelectionFont = New System.Drawing.Font(ComboBox1.Text, RichTextBox1.SelectionFont.Size, RichTextBox1.SelectionFont.Style)
Catch ex As Exception
MsgBox(ex)
End Try
End Sub
Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
Try
RichTextBox1.SelectionFont = New Font(Font.FontFamily, ComboBox2.Text)
Catch ex As Exception
MsgBox(ex)
End Try
End Sub

Hope you liked it!!!
If you like my tutorials please give me +rep

Here are the project files
You do not have the required permissions to view the files attached to this post.
Instead of LOL use this -
LSIBMHBIWFETALOL
Which means -
Laughing silently in between my head because it wasn't funny enough to actually laugh out loud!
LSIBMHBIWFETALOL
Which means -
Laughing silently in between my head because it wasn't funny enough to actually laugh out loud!
Hello Coderboy, Once again a great and useful tutorial but I just can't +rep you cuz I did it a few hours ago. Maybe later. Keep up the good job.
2 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023