Visual Basic - Button to run command or vb script?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mrmwalter@yahoo.co.uk

    #1

    Visual Basic - Button to run command or vb script?

    Hi,

    I need to create a GUI that has a form, on the form it asks for
    username. I therefore decided to use Visual Basic (not much
    experience_ On the form will be a button, how do I get this button to
    then launch a vbscript, oe even a batch file when it is clicked?

    Thanks.
  • Tom Shelton

    #2
    Re: Visual Basic - Button to run command or vb script?

    On Dec 5, 3:01 pm, mrmwal...@yahoo .co.uk wrote:
    Hi,
    >
    I need to create a GUI that has a form, on the form it asks for
    username. I therefore decided to use Visual Basic (not much
    experience_ On the form will be a button, how do I get this button to
    then launch a vbscript, oe even a batch file when it is clicked?
    >
    Thanks.
    Take a look at System.Diagnost ics.Process. If you have any further
    questions, let us know.

    --
    Tom Shelton

    Comment

    • Lloyd Sheen

      #3
      Re: Visual Basic - Button to run command or vb script?


      <mrmwalter@yaho o.co.ukwrote in message
      news:24e0828c-e0c5-48de-9d59-20e6169edf91@w4 0g2000hsb.googl egroups.com...
      Hi,
      >
      I need to create a GUI that has a form, on the form it asks for
      username. I therefore decided to use Visual Basic (not much
      experience_ On the form will be a button, how do I get this button to
      then launch a vbscript, oe even a batch file when it is clicked?
      >
      Thanks.
      What you are looking for is the Process class.

      There are several versions of Process.Start. If the filename extension is
      known to windows you can use the simple one by just using the name of the
      file you want to start (acts like a double click in explorer).

      If you have parameters there is a version where you give the filename
      followed by a string with the parameters.

      It would be something like (not a workstation with VS).

      dim p as Process
      p=Process.Start ("C:\my folder\my batchfile.bat")
      p.WaitForExit()

      the last statement will wait until the process finishes if this is important
      to what you are doing.

      Hope this helps
      LLoyd Sheen

      Comment

      • mrmwalter@yahoo.co.uk

        #4
        Re: Visual Basic - Button to run command or vb script?

        Lloyd - Tom,

        That's excellent - does exactly what I wanted it to do - thanks very
        much for your help, very much appreciated!

        Comment

        Working...