In this article, we will create a program that has a copy and paste functions of any Text Documents. I already made this tutorial in vb6.0 but here we will use vb.net.
Now, let's start this tutorial!
1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to
File, click
New Project, and choose
Windows Application.
2. Next, insert two Buttons for the Copy and Paste Functions named
Button1 labeled it as "
Copy", and
Button2 labeled it as "
Paste". Add also two TextBox named
TextBox1 and TextBox2 from the toolbox. You must design your interface like this:
3. For button1_click as Copy button, put this code below.
My.Computer.Clipboard.SetText(TextBox1.Text)
My namespace makes the system function easier to locate by giving access to commonly used methods, properties, events, and tools. The clipboard here provides methods to place data from the system Clipboard that we have set the text value of TextBox1.
4. For button2_click as Paste button, put this code below.
If My.Computer.Clipboard.ContainsText Then
TextBox2.Text = My.Computer.Clipboard.GetText
End If
If the system ClipBoard contains a text that we have set earlier in textbox1, then the copied text will be retrieved its value as we have the GetText method of the clipboard that will be displayed in textbox2.
Output:
Download the source code below and try it! :)
For more inquiries just contact my number or e-mail below.
Best Regards,
Engr. Lyndon R. Bermoy
IT Instructor/System Developer/Android Developer
Mobile: 09079373999
Telephone: 826-9296
E-mail:[email protected]
Visit and like my page on Facebook at: Bermz ISware Solutions
Subscribe at my YouTube Channel at: SerBermz