I got another problem::::::-----
I'm not able to reach these folders via C# code:-
C:\\Documents and Settings\\gsvsnl\\My Documents\\y Pictures\\gs.bmp
C:\\Documents and Settings\\gsvsnl\\Local Settings\\Application Data\\Microsoft\\gs.bmp
I tried something like this:-
string var1 = System.Environment.SpecialFolder.MyPictures.ToString() + "\\gs.bmp";
string var2 = System.Environment.SpecialFolderApplicationData.ToString() + "\\gs.bmp";
But I'm not able to get there..... Error popup says:
Could not find a part of the path 'MyPictures\gs.bmp'
MyPictures in the popup should have space in it na?? My Pictures What do u say????

9 answers
The reason why your code isn't working is because System.Environment.SpecialFolder is an enum and so the following expression:
just returns 'MyPictures'.
To get the associated path you need to use the System.Environment.GetFolderPath() method:
However, I agree with muster that, unless you're sharing them amongst several applications, it's usually preferable to keep all your files together either in your application's directory or a sub-directory thereof.
answered one year ago by:
17279
412
Thx so much for the explanation and the solution too. I do make lots of mistakes :)
btw the path might not be correct:
C:\\Documents and Settings\\gsvsnl\\My Documents\\y Pictures\\gs.bmp(its my pictures instead of y Pictures)
Beside this its always not preferable to store files in these directories so you might face some security problems. its better to store files in a directory in the root directory of the application by
answered one year ago by:
1556
412
"y Pictures" was a typo mistake only. Otherwise I do take care while typing the paths :) I do agree with u (root directory), but here I just wanted that a specified file like gs.bmp should be taken as wallpaper as soon as the winform loads. I selected "My Pictures" directory bcoz this directory will be available on all computers.
How can I delete a file from a particular path using the code???? Is there any option to supress the "delete file confirmation" dialogue box????
answered one year ago by:
412
you can delete a file by System.IO.File.Delete(filePath); to suppress the delete file confirmation dialogue box do this:
if (System.Windows.Forms.MessageBox.Show("Do you want to delete this file?", "Delete", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)System.IO.File.Delete(filePath);
answered one year ago by:
1556
Why is this line not correct????
I'm just trying to get today's date in dd-mm-yyyy format.
answered one year ago by:
412
Well, if the day and/or month is a single digit, then that's all you'll get with that expression.
I'd use:
string date = DateTime.Now.ToString("dd-MM-yyyy");answered one year ago by:
17279
I was just trying to add today's date in the file name.....
Why this method was wrong???
Error is:
A field initializer cannot reference the non-static field, method, or property 'ExcelData.Form1.date'
answered one year ago by:
412
17279
In what way is it "wrong" ?
How should I calculate this function in C#????
Value = 25 Log of 10 [ 1 / y ]; ???
answered one year ago by:
412
1556
try asking a question on a different thread instead of the same thread since the question is different than the main thread question because the thread is only limited to 20 answers/questions.
try this:
answered one year ago by:
1556