Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 16th, 2008, 09:26 PM
Registered User
 
Join Date: May 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to elfman5555 Send a message via Yahoo to elfman5555
Default Creating a button to run a windows command

I was looking through the book that I purchased (Beginning VB.NET - 2nd Edition) some time ago and was looking a for a code that would enable me to run a windows command by using a Command Button. I am new to the VB .NET world. If anyone has any good idea or knows the line of code that I could use to run the command, that would be greatly appreciated.

Thanks,

Sean

 
Old March 17th, 2008, 12:39 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

What do you mean by “a windows command”?
 
Old March 23rd, 2008, 12:10 AM
Registered User
 
Join Date: May 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to elfman5555 Send a message via Yahoo to elfman5555
Default

I want to be able to shutdown a windows service.
In this case, I'm using the net stop command.
I basically want the button, when I click on it, to run the net command. (i.e. net stop <service>)
It should, when I click on it, open up and command prompt and run the net command.
Hope this makes sense.

Thanks


 
Old March 23rd, 2008, 06:38 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You could use a System.Diagnostics.Process class to run the command, but this won't behave visually like you describe. There may also be a cleaner way to manipulate services through managed .net classes. Is your goal to literally start a command prompt in which you shut down a service using the "net stop" command or is it to actually just shut down a service? If it's the latter and you can control the service programmatically, you could provide your own visual feedback for it while having much more control over the process (i.e. detecting failed operations) so make your application more robust.

-Peter
peterlanoie.blog





Similar Threads
Thread Thread Starter Forum Replies Last Post
Run from command line with arguments bdancis Excel VBA 4 June 21st, 2012 12:47 PM
'Hidden' Command Button David Mulvey Word VBA 0 January 9th, 2007 11:21 PM
Windows Command Help airmac Need help with your homework? 0 March 31st, 2006 12:08 AM
command button qry mohiddin52 Access 0 December 22nd, 2003 08:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.