Solved

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

Posted on 2009-05-20
1
168 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now