getting File path??
-
How to get the file path on mouse right click in c#?
Thanks & Regards, Venkat
-
How to get the file path on mouse right click in c#?
Thanks & Regards, Venkat
Please search on msdn first ..... then search on google ..... followed by looking in the previous posts ...... If you still do not get answers, post a message here ... Regards, Bhupi Bhai.
-
Please search on msdn first ..... then search on google ..... followed by looking in the previous posts ...... If you still do not get answers, post a message here ... Regards, Bhupi Bhai.
I had posted this message only after searching in google and msdn.. I have a windows based application in c#. On Windows explorer context menu i added one context menu item named "MyContext" . when the user right clicks on a file or folder, i have "MyContext" menu(This is the context menu item that i have added to the windows explorer context menu). When i click "MyContext" menu, i have to execute one application. In that application page load, i want to get the file or folder path that the user right clicked. How to get that file path?? Please help -- modified at 5:19 Wednesday 3rd January, 2007
Thanks & Regards, Venkat
-
How to get the file path on mouse right click in c#?
Thanks & Regards, Venkat
What you are talking about is called Windows Shell programming -not context menu:)-. In CodeProject there is a very good section about Shell programming. i think you can find the anwer there. Click here[^].
Regards:rose:
-
What you are talking about is called Windows Shell programming -not context menu:)-. In CodeProject there is a very good section about Shell programming. i think you can find the anwer there. Click here[^].
Regards:rose:
I agree that this is windows shell programming. In that path is generated by args[0]. I have an application, which contains a tab control. inside the tabcontrol i am having a textbox. I am getting the string args[0] value from the program.cs file. I want to assign the string args[0] value to the textbox. How to assign that value to the textbox? This is the program.cs file static class Program { public static string pathkey; public static string path { get { return pathkey; } set { pathkey = value; } } [STAThread] static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); Form1 objform = new Form1(); try { Program.pathkey= args[0].ToString (); } catch (Exception ex) { } Form1.cs ********* In my form1 load, i am assigning the value to the textbox txtLocation.Text = Program.pathkey.ToString(); But i am not able to get the value? In registry i have the entry as C:\Documents and Settings\venkadeshp\My Documents\Visual Studio 2005\Projects\HCI_DMS ConsoleApplication\bin\Debug\HCI_DMS ConsoleApplication.exe %1 . But i couldnt find the file path in the string args[0] in the program.cs main function? Thanks & Regards, Venkat
-
I agree that this is windows shell programming. In that path is generated by args[0]. I have an application, which contains a tab control. inside the tabcontrol i am having a textbox. I am getting the string args[0] value from the program.cs file. I want to assign the string args[0] value to the textbox. How to assign that value to the textbox? This is the program.cs file static class Program { public static string pathkey; public static string path { get { return pathkey; } set { pathkey = value; } } [STAThread] static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); Form1 objform = new Form1(); try { Program.pathkey= args[0].ToString (); } catch (Exception ex) { } Form1.cs ********* In my form1 load, i am assigning the value to the textbox txtLocation.Text = Program.pathkey.ToString(); But i am not able to get the value? In registry i have the entry as C:\Documents and Settings\venkadeshp\My Documents\Visual Studio 2005\Projects\HCI_DMS ConsoleApplication\bin\Debug\HCI_DMS ConsoleApplication.exe %1 . But i couldnt find the file path in the string args[0] in the program.cs main function? Thanks & Regards, Venkat
Venkatesh.P wrote:
How to assign that value to the textbox?
Simple. In your Main method
[STAThread]
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1(args[0]));
}and in Modify your form constructor to this
Form1(string thePath)
{
MyFileName = thePath;
//more code
}PS. The first argument would be the path to your exe file BTW, and the second argument is the "%1" command which is used to instruct the program to open the file -not print it for example-. The Thrid argument -i.e. args[2]- I bilieve is what you are looking for. Try to show them one by one in
MessageBox
s ro see the value of each before deciding which to pass to the Form's constructor.Regards:rose: