Solved

How do i create a VB application with buttons that will run a vbscript

Posted on 2009-05-20
1
173 Views
Last Modified: 2013-12-26
Ok guys/girls this has probably been answered 1000 times over, but essentially i'm trying to create a gui interface to allow users to simply click a button to install network printers, when they are at different branch offices, e.g. location1 has 10 printers, i want all of those printers at that location mapped, then location2 has 5 printers, i want them mapped too because i'll be going there next month.

i have already got the vbscript files to work using the first two lines of code below

I've designed the form, but the buttons on the form but now i'm stuck at trying to get them to link to the vbscript to run. is this even possible?
I'm using Visual Studio 2008 Sp1, although if need be i can go back to VS 2k5 but shouldn't make a difference really.

I hope this makes sense at what i'm trying to do.
Set WshNetwork = CreateObject("Wscript.Network")
WshNetwork.AddWindowsPrinterConnection "\\%servername%\%printername%

Open in new window

0
Comment
Question by:jpriddle
1 Comment
 
LVL 5

Accepted Solution

by:
Tompa99 earned 500 total points
ID: 24429582
Hi,

Try this.

        private void button1_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start("c:\\vbscript\\test.vbs");
        }

Best Regards Tompa
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question