Posted in General

How to open a Url or execute a command line in Windows .NET Applications

Ok a little senario, we wanted to open a URL when user clicks a button from a windows application. I know that .NET has a process class and it can start a process (in shorts acts like a command line). This is what the proposed solution was.

'A VB.NET Example
Dim p As New Process
p.Start("notepad.exe", "D:\Documents and Settings\abi\Desktop\TODO.txt")
p.Start("iexplore.exe", "www.roadhouse.com.au")

//A C# Example
Process p = new Process();
p.Start("notepad.exe", @"C:\Documents and Settings\abi\Desktop\TODO.txt");
p.Start("iexplore.exe", "www.roadhouse.com.au");

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s