This is a tutorial in which we will going to have a program that can launch any applications, program, and websites.
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 <b>File</b>, click <b>New Project</b>, and choose <b>Windows Application.</b>
2. Next, add only one Button named Button1 and labeled it as "Run" and one textBox named TextBox1 that will serve as our input. You must design your interface like this:
3. Now put this code for your code module. This code is for Button1_Click:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
On Error Resume Next
Process.Start(TextBox1.Text)
End Sub
<b>Explanation:</b>
We first code for an <b>On Error Resume Next</b> which specifies that when a run-time error occurs, control goes to the statement immediately following the statement where the error occurred, and execution continues from that point. Then we have the Process.Start method to start the method inputted in TextBox1. This starts a process resource by specifying the name of a document or application file and associates the resource with a new Process component.
<b>Output:</b>
Walang komento:
Mag-post ng isang Komento