Run Command in vb.net



Create Run Command in vb.net


Want to know how to create run command in vb.net? Here is a simple and quick tutorial along with original vb.net solution file which will show you how to create your own run command. The process is easy and really quick but to make it easier lets divide it into following steps.

  • Designing
  • Coding

Designing


Create a new vb.net Project. Name it anything you want as I have named it “run command in vb.net”. Design it something like this.



No.      Control Type                Name

1          Label                            label1
2          Text Box                      textbox1
3          Button                          run
4          Button                          exti

Note: Control no 4 name is “exit” not “exit”

Coding


Double-Click on “run” button (Control no: 3) and write the following in it.

        Try
            Process.Start(TextBox1.Text)
        Catch ex As Exception
            MsgBox("Path does not exist")
        End Try

Now Again go to designer view and double click on ‘Exit” Button (control no: 4) and write the following code in it.

    Application.Exit()

And that’s it. Run the program by Pressing F5. Enter a path in text box Like for starters try “C:\” and click on “Run” button (control no: 3).
And “C:\” drive should be opened

Written By:
Shehan Abid (SH3H@N)
For:
SH3HANWARES.blogspot.com


0 comments:

Post a Comment

Powered by Blogger.