473,765 Members | 2,057 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.
Dec 5 '07 #1
3 8110
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
Dec 5 '07 #2

<mr*******@yaho o.co.ukwrote in message
news:24******** *************** ***********@w40 g2000hsb.google groups.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

Dec 5 '07 #3
Lloyd - Tom,

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

Dec 6 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2152
by: Tom Rahav | last post by:
Hello all! I develop application in Visual Basic .NET and ORACLE database. My question is how do I "send" script file to the database using visual basic .net. Other words, is there any way to send to the database a script file to run, as done by: "@FullPath\FileName" in SQL PLUS ? If not, then I need your help with something else: I tried to send to the database the script file's content, in order to run the commands in it (create...
10
8205
by: Steve | last post by:
I am trying to create a DLL in Visual Studio 2005-Visual Basic that contains custom functions. I believe I need to use COM interop to allow VBA code in Excel 2002 to access it. I've studied everything I can find on COM Interop and .NET. I've also tried many of the 'Walkthroughs' on the MSDN site relating to COM add-ins, .NET and Office XP but am unable to get even these working in Excel 2002 or Word 2002. I've installed the Office XP...
0
1699
by: Faez | last post by:
i am using Visual Studio 2005 with Visual Basic language. i have a command button, labelled 'SEARCH' and i want to add the following code to the button; so that when people click on the search button (at run time), they could see the result from the search engines. the code is in HTML and i don't know how to translate or convert into VB code. ...
0
2304
by: AJIT PITALE | last post by:
Hi, I am using Visual Basic 6 as front end and Visual FoxPro as a Database. I am trying to pass a parameter from VB to Visual FoxPro's Stored Procedure. I am getting an error showing "Data type mismatch" My Connection String is :CNN.ConnectionString = "Provider=VFPOLEDB.1;Data Source=P:\pay.dbc;Mode=ReadWrite|Share Deny Write" CNN.Open
5
3872
hussaini
by: hussaini | last post by:
please tell me any 1 printing code in datagrid in visual basic 6 in detail ----- Hello seniors members hope u will tell me ..... i have created a form in visual basic 6 so in the form there is a datagrid and a command button so i want to print the records in datagrid when i press that command button it open dailog like ms word CTRL + P its open of printing dailog hope u understand what i meant
0
6850
AHMEDYO
by: AHMEDYO | last post by:
Hi Every one... With this visual Basic 6.0 Code you can handle more event that visual basic Support as Mouse wheel and hover or you can control event before VB IDE Default Windows proc as WM_CREATE when windows start creation, this task is useful for some application , for example you can create new UI Control at run time using Form1.Control.add("vb.CommandButton","Cmd1") Function and you can handle command button event by WM_COMMAND Message...
2
10022
by: mixalis21 | last post by:
hi, i really need to know in this month a way to take data from a vb form and put then in particular places in a word/excel document which i have already created. for example, i have a text box named n1, a command button called c1 and my report is called "myrep.doc" or "mydoc.xls". what would be the script in the command button action, so that when i press the button the program will take the value from the text box "n1" and put it in a...
16
2818
by: AirborneBob | last post by:
I just installed MS Office Enterprise on my system today and jumped right in to MS Access. Because I am familiar with Access I had very few problems navigating around. Here is the big question. Where is the Visual Basic Code??? I made a form and placed an Add Record button on the form. When the user clicks this button, I want to focus to go the the first field on the form. I usually do this with the setfocus command in visual basic. ...
7
17958
by: rmurgia | last post by:
When a variable is created using Javascript, should it then be able to be read immediately using embedded VB code or does the submit command have to be entered or are the variables between javascript, visual basic, and vbscript non-interchangable? I created the following code: <script language="javascript"> function question(){ strReply = confirm('Click Yes if you wish to continue.') alert(strreply) } </script>
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9835
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8833
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7379
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5277
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3926
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.