The Way to Programming
The Way to Programming
VB.NET – If you are looking for a good way to make the application development easier then this is the right place where you can find the solution. Here we are discussing about the development of text editor project in VB.NET.
Text editor is a component that is used to create and modify the content of the file. It is also called the WYSIWYG or what you see is what you get editor. It is not only useful for creating the content of the document but also it is used to edit the content of the document.
There are different text editors available in the market. Some of the best ones are Microsoft Word, Adobe Photoshop, etc. But, you don’t need to buy any text editor software to make your own. You can make the same as well by using VB.NET.
Let us start by creating a blank form in Visual Studio.
First, create a new VB.NET project and name it as ‘text editor’.
Then, add a TextBox control to the form and name it as ‘TextBox1’.
Now, drag and drop the RichTextBox control to the form.
After that, add a Button control and name it as ‘Button1’.
Now, double click on the Button control and change the caption to ‘Click Me’.
Finally, add a Label control and name it as ‘Label1’.
In the above screenshot, you can see that I have added a button to the RichTextBox control. Now, let us move on to coding.
Add the following code to the Click event of the button:
[dm_code_snippet background="no" background-mobile="no" slim="yes" bg-color="#abb8c3" theme="dark" language="clike" wrapped="no" height="" copy-text="Copy Code" copy-confirmed="Copied"]
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click If TextBox1.Text = "" Then MessageBox.Show("You must enter the text to be edited") Else TextEditor1.SelectionColor = Color.Blue TextEditor1.SelectionBackColor = Color.White TextEditor1.SelectionForeColor = Color.Black TextEditor1.SelectionFont = New Font(TextEditor1.Font, FontStyle.Regular, FontWeight.Bold) TextEditor1.SelectionFont = New Font(TextEditor1.Font, FontStyle.Italic, FontWeight.Bold) TextEditor1.SelectionFont = New Font(TextEditor1.Font, FontStyle.Underline, FontWeight.Bold) TextEditor1.SelectionFont = New Font(TextEditor1.Font, FontStyle.Strikeout, FontWeight.Bold) TextEditor1.SelectionFontSize = 25 TextEditor1.SelectionWordWrap = True TextEditor1.Text = "" End If End Sub
[/dm_code_snippet]
Save the project.
Sign in to your account