Member Avatar for m.a.u.

Greetings,

I have been trying to see all the files in computer, but since accesses of some files are denied my program throws exception. When I show the type of exception with a MessageBox I learnt it is about mscorlib.dll. I can make my program run not throwing exception using assemblies. But if I wanted to prevent the program to throw exception what would you suggest to me to do? Should I download and set up, or I saw somebody had a similar problem and he solved it uploading related file, *.dll . By the way, I use C# for my application.

Thanks everybody

Hi there!
"But if I wanted to prevent the program to throw exception what would you suggest to me to do?"
Hm... well you can always use the 'try-catch' structure ,with an empty catch part.
Example:

static void Main(string[] args)
{
            char[] ch = new char[1]{'2'};
            try { Console.WriteLine(ch[-1]); }//this is useless but it's simple and throws error ^^( since there is no -1 indexed element in an array)
            catch {/*Write the code to be executed if the code in the try{} part throws an exception, leave it empty if you want to ignore the exceptions.*/}
}

I hope this helps.
Andrew

Member Avatar for m.a.u.

Hi dear friend,

I already solved this problem at the day I asked. But thanks.

Note: I follow a smilar way, leaving catch empty, without any code. Because , openning all the folders is not the point I focus on.

Thanks,
m.a.u.

Okay than! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.