|
What is the name of the unaccessible folder? There are certain folders in the root, and possibly elsewhere, that you simply don't have access to, unless you are some form of 'god' user. You are trying to set attributes on this folder in a catch? You've also caught a generic exception. Look to see what exceptions GetFiles will throw, catch and handle those specifically.
Key thing - which file / directory is giving you problems? What security context are you running under? What error do you get when you attempt to change the attributes?
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"I haven't spoken to my wife now for 48 hours. I don't like to interrupt her.
|
|
|
|
|
Malcolm Smart wrote: unless you are some form of 'god' user.
..
Thanx Malcom but it seems like i have to do it the hard way.. "you know, digging subfolders using nested loops and recursion, listing files, see what's accessible and what's not and then deal with it"..
I'm on it and will let everyone knows the solution once I get it working, thanks again for your time Malcom!
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hi,
yes you need to do the recursion yourself, and catch (and probably just ignore)
the exception you would get on unaccessible folders...
It is one of the rare cases ignoring an exception makes sense.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
i try to create some app to play mp3. major function already finished. but, r there some code to set the equalizer?
not too important though, but i really want to create some serious app.
-- modified at 1:28 Wednesday 15th August, 2007
Training makes perfect....
|
|
|
|
|
Has anybody worked with .NET and connecting to Oracle?
I am attempting to connect to Oracle using .NET 2.0. I used the Data Source=Oracle db, name and password connection string. What are the other connection strings? I seen Integrated used as part of the connection string. There isn't much out there on Oracle and .NET.
Thanks
|
|
|
|
|
Looks to me like there's plenty[^] of info around on the topic.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
|
Anyone know how to create shape file in C#?
|
|
|
|
|
|
Yes, the specification i know.my problem is i don't know how to start to code the program in C#. any sample that able for me to refer? Thanks
|
|
|
|
|
Ah, OK. Well, it's not super complicated - here's[^] a project that's implemented a reader/writer in c#. Hope that helps.
Cheers,
Drew.
|
|
|
|
|
Am new to C#.....How to start after download those information.
|
|
|
|
|
What languages do you know ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i only know vb.but this project i need to write in C#.so a bit headache.
|
|
|
|
|
VB.NET and C# are very similar. In fact, you can buy tools that allow you to write in VB.NET and convert to C#.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Anyway thanks.....am just a student, not effort to spent money to buy tools....i look for others alterntive
|
|
|
|
|
There are free tools as well, they are just not as good. Your only other alternative is to learn C#, no-one is going to write the code for you.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Dont worry, i never wish forum will give me a complete code, just reference like read me and etc. thank you for you concern!
|
|
|
|
|
I have a small test program using MS Word.
I only want to control the user open and close some MS Word document.
In my program,when the user want to open a document,I create a new Word.Application and a new Document ,then open the document. There is no problem when the program runs.
But when the user close the document or the MS Word,problems occur.I want to prompt the user if he or she would like to overwrite the exsit file.I hope someone would like to give me a solution.Because,I use SaveFileDialog,some exception would puzzle me.
Thanks.
GOOD LUCK
|
|
|
|
|
What is the exception? Post the portion of code that is causing the problem.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"I haven't spoken to my wife now for 48 hours. I don't like to interrupt her.
|
|
|
|
|
There,when my finish my task(open a new document and save it),the Word would tell me it come up some problems so that should be close and restart!
Really,I only want to open a document and save it as other file.i.e.If some changes occur,it would prompt the user to save or not.That is,I want to control some usual beheavor of Word.
Thanks.
GOOD LUCK
|
|
|
|
|
Hi,
I have a project that needs to do many, many DNS lookups. I have done a bit of reseach and come up with the following code:
for (int x = 0; x < hostList.Count; x++)
{
figure out how to get the delegated method to update a datatable or an array in the main thread.
getIP.BeginInvoke(hostList[x], new AsyncCallback(MyCallback), getIP);
}
The call back is:
void MyCallback(IAsyncResult ar)
{
getDNS getIP = (getDNS)ar.AsyncState;
string result = getIP.EndInvoke(ar);
MessageBox.Show(result); <-- just so I know it works - testing purpose.
}
I now have the problem that I can't reference the original object/string passed to 'ar' so that I can match it up with the result and then update the datatable (or array or whatever).
I originally considered backgroundworkers to do the job but I think that is overkill. Surely I can achieve what I want with the IAsyncResult.
If anyone care to comment or make suggestions so I can get past this brick wall it would be much appreciated.
Thanks.
Glen Harvy
|
|
|
|
|
Is this in a Form application? If so...
delegate void Result(string s);
delegate void ExceptionHandler(Exception ex);
private void MyCallback(IAsyncResult ar)
{
getDNS getIP = (getDNS)ar.AsyncState;
try
{
string result = getIP.EndInvoke(ar);
BeginInvoke(new Result(MyResultMethod), result);
}
catch(Exception ex)
{
BeginInvoke(new ExceptionHandler(MyExceptionHandler), ex);
}
}
private void MyResultMethod(string s)
{
MessageBox.Show(s);
}
private void MyExceptionHandlerMethod(Exception ex)
{
MessageBox.Show(ex.Message);
}
The above should work. Generally, you don't want to catch Exception s, but rather one or more of the derived exception classes. It may be ok in this situation. Not sure.
|
|
|
|
|
Krikey - thanks.
I've been up a long time now and will need to digest this but it looks like what I need to know.
Thank you very much.
Glen Harvy
|
|
|
|