Whenever we are developing windows application in .net so in
some scenario we need to open prompt. So in this article I will show you how
you can open a command prompt using C#.Net in your windows application.
In my precious article I have shown you How
to show Error & Warning Message Box in .NET, for event handling in check
this article Connect
Multiple Events to a Single Event Handler in Windows Forms Using C#.Net and
VB.Net. Here are some of the articles for list for listbox control How
to add/move multiselected items from one listbox to another listbox in C#.Net
and VB.Net | C# multiple selection listbox move Using C#.Net.
So for this article first will create a new windows
application and add the add a button control. On click event of button control
add the below code.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ProjectDemo_Windows
{
public partial class Form2 : Form
{
public
Form2()
{
InitializeComponent();
}
private
void button1_Click(object
sender, EventArgs e)
{
string
strCmdText;
strCmdText = "cd..";
System.Diagnostics.Process.Start("CMD.exe",
strCmdText);
}
}
}
|
Now run the application to view the output.
Click on button control
How to change path?
ReplyDelete