|
hello,
I've linked a file to start my app when you open it (like .doc files open Word)
The problem is that the System.IO.Directory.GetCurrentDirectory() gives the path of the file instead of the path where my exe resides.
Is there a way to change this back? (without hardcoding it)
thanks.
V.
I found a living worth working for, but haven't found work worth living for.
|
|
|
|
|
Use Application.ExecutablePath
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
TNX !!
I used Application.StartupPath
|
|
|
|
|
You can get the path of your executable using this property:
System.Reflection.Assembly.GetExecutingAssembly().Location
Based on this, you can get the directory of the executable and make it the current working directory (by calling System.IO.Directory.SetCurrentDirectory with that path).
|
|
|
|
|
TNX ! I used Application.StartupPath
|
|
|
|
|
The System.Windows.Forms.Application.ExecutablePath property has the following comment:
Gets the path for the executable file that started the application, including the executable name.
You can then extract the path from here.
You could also use the executing assembly and work from there.
System.Reflection.Assembly.GetExecutingAssembly().Location
|
|
|
|
|
Tnx, I used Application.StartupPath
|
|
|
|
|
Did you use Application.StartupPath?
|
|
|
|
|
Was it wrong or did you just post this because I replied to all of them the same thing
|
|
|
|
|
V. wrote: or did you just post this because I replied to all of them the same thing
It seemed like a rubber stamp.
But seriously, if it works, great. But as a practice, use the other method. It covers you for all types.
|
|
|
|
|
What did you reply I missed it.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
As i want to add custom folder attributes in the root folder of namespace extension. While i am using the SFGAO_HASSUBFOLDER like wise , I am getting the system folder attributes only. Instead of that i want to add my own folder attribute in the root. Say " Login As" in the root of the virtual namespace extension.
As i am quite novice in shell programming, please help me to resolve the same.
Aruna
|
|
|
|
|
Try posting it again. Twice might not be enough.
|
|
|
|
|
Be nice now, its URGENT
Programmer: A biological machine designed to convert caffeine into code. * Developer: A person who develops working systems by writing and using software.
[ ^]
|
|
|
|
|
As i want to add custom folder attributes in the root folder of namespace extension. While i am using the SFGAO_HASSUBFOLDER like wise , I am getting the system folder attributes only. Instead of that i want to add my own folder attribute in the root. Say " Login As" in the root of the virtual namespace extension.
As i am quite novice in shell programming, please help me to resolve the same.
Aruna
|
|
|
|
|
i am trying to read a memo field of database using oledb datareader after executing the query like below
datareader.GetValue(0).ToString() which only reading the first 255 chars in the memo field how could i read the whole contents at a time
please help.
|
|
|
|
|
What database are you using that has Memo fields?
|
|
|
|
|
Sounds like MS Access. If at first you don't succed give up go play XBox
Try something other than a datareader. Try a datatable or if you are only intrested in on field use a SQL statement and run a OleDbCommand.ExecuteScalar();
Programmer: A biological machine designed to convert caffeine into code. * Developer: A person who develops working systems by writing and using software.
[ ^]
|
|
|
|
|
Try something like this:
dr.Read();
FieldLen = dr[MemoCol].Length;
char[] MemoBuffer = new char[FieldLen];
int startIndex = 0;
retVal = dr.GetChars(1, startIndex, MemoBuffer, 0, MemoBuffer.Length);
Console.WriteLine(MemoBuffer);
|
|
|
|
|
Hi,
My XML file contains Method List.
In my application contain 2 Threads.
First Thread reading Method from XML file and starting the 1st Thread.
Second Thread reading Method from XML file and starting the 2nd Thread.
Onec which ever thread complete method it's takes next method.
this process going until all the method over.
How to do this
it's arrgent.
Plz help me out.
|
|
|
|
|
If you're calling them sequentially, what's the point?
|
|
|
|
|
It's my fault.
I have explain properly.
Basically What I want
In my program, two thread running.
Both thread taking method Name from Array and and executing.
Array containning Method Name List.
Only method name from the Array.
problem is when i m assigning like this i m getting error.
Error "strMN is a Variable but it's used like Method"
strMN getting value from the Array.
strMN is Variable Name.
Code :-
string[] strMName = strMethodName.ToString().Split(' ');
Console.WriteLine("Thread running");
for (int i = 0; i < strMName.Length; i++)
{
string strMN = strMName[i].ToString();
// create a thread for the Incrementer
Thread trdIncrementer = new Thread(new ThreadStart(strMN));
trdIncrementer.Start();
// create a thread for the Decrementer.
Thread trdDecrementer = new Thread(new ThreadStart(strMN));
trdDecrementer.Start();
}
Error "strMN is a Variable but it's used like Method"
Methods:-
///
/// demo function for Incrementer, counts up to 10.
///
public void Incrementer()
{
lock (trdIncrementer )
{
for (int counter = 0; counter < 10; counter++)
{
// assign the incrementer value and display the results
Console.WriteLine("Incrementer: {0}", counter);
}
}
}
///
/// demo function for Decrementer, counts down from 10.
///
public void Decrementer()
{
lock (trdDecrementer)
{
for (int counter = 10; counter >= 0; counter--)
{
// assign the decremented value and display the results
Console.WriteLine("Decrementer: {0}", counter);
}
}
}
help me out .
It's arrgent.
Thanks
|
|
|
|
|
I have two thread.
I have more than one method in the array.
I want Two thread should run side by side.
and execute methods.
Suppopse array contains four method name:
1.A
2.B
3.C
4.D
So,
First thread take A method name from the array.
Second thread take B method name from the array.
Once Any of these two thread comleted their task then it has to take next C
method from the array....
Example:-
if suppose 1st thread complete before 2nd thread. it' should take 3rd method name then 2nd thread should not take 3rd method name from the array. it should take 4th method name from the array.
Thanks
|
|
|
|
|
You may want to study some on threads and synchronization for your solution. However I may be wrong because:
asif_aslam wrote: First Thread reading Method from XML file and starting the 1st Thread.
First thread starts the first thread? I am pretty sure that cannot happen.
and...
asif_aslam wrote: Onec which ever thread complete method it's takes next method.
We have a communication breakdown because I have no idea what that means.
led mike
|
|
|
|
|
It's my fault.
I have explain properly.
Basically What I want
In my program, two thread running.
Both thread taking method Name from Array and and executing.
Only method name from the Array.
problem is when i m assigning like this i m getting error.
strMN is Variable Name.
strMN getting it's value from the Array.
like this.
string strMN = strMName[i].ToString();
Thread trdIncrementer = new Thread(new ThreadStart(strMN));
Error :-> "strMN is a Variable but it's used like Method"
help me out .
It's arrgent.
Thanks
|
|
|
|