adding functions to a Botton in my Form

Hi All

I am new in VB 2005. I am trying to create a form that will have two function, a reboot and a cancel botton. I am not sure how to add reboot or any other function to the botton when the user click on the botton that he will get on his desktop screen.

As an example. if I open my command prompt I can type SHUTDOWN -r , and my machine will reboot. I want to add this function to the reboot botton when the user choses to click on the botton. Any suggestion on how I can do this.

Thank

Wajdi Georges




Answer this question

adding functions to a Botton in my Form

  • Nathaniel Chan

    Thanks you, adding the

    System.Diagnostics.Process.Start("ShutDown", "/r") to the function of the botton did the trick,

    Many thanks,

    one more qtion since I am new in this area, how can I call another script buy clicking a botton, I mean a batch file as an example.

    Thanks



  • postman7342

    Just do the same class and function, only replace "ShutDown" with the name (or path & name) of your patch file and remove the "/r" (and preceding comma) (unless you need to specify arguments to it).

  • ShawnKY

    Thanks again, that worked, another qtion

    1- Is there a way to disable ALT+F4 on the dialouge window

    thanks



  • cbpd86

    I think you meant to throw in:

    System.Diagnostics.Process.Start("ShutDown", "/r")

    to actually call the system's shutdown.exe and pass in the /r flag.



  • nick5454

    Assuming you've already got a StatusBar or other control(s) that provide you with the buttons to click... take a look at the sample code here on how to shutdown/reboot/logoff a system from VB.NET.

  • Tony Han

    Private Sub Reboot_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    SHUTDOWN -r

    End Sub



  • adding functions to a Botton in my Form