Click here to Skip to main content
15,905,614 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have made a Simple Program, which edits Text Documents. It uses A class library call Text.dll.

After I publish my Application, And open the published folder there're 2 file, One is TextEditor.exe and the other one is Text.dll. (Text.dll is used to write/read txt files)

When I delete the Text.dll, run the application and try to save a text file. But It gives me a system Error from .Net FrameWork. How Can I Convert That to a message of mine ?
Posted

Use CustomErrors tag
custom errors in asp.net"
 
Share this answer
 
Comments
Captain Price 3-Dec-11 10:23am    
It's about ASP.NET, but I'm talking about windows forms applications !
uspatel 4-Dec-11 5:46am    
I think it will be exception.
use try catch block, and in catch block print message at label or in messagebox
You should either use try-catch blocks or check the existance of file at the starting point. You can find the use of try-catch block on google or MSDN site so i will not explain it here.

Use of file checking should do:

1) Open Project

2) in the event code write

C#
if (File.Exists(filePath)){
    Application.Run(new StartForm);
}
else
{
    MessageBox.Show("File not found");
}


That should work out for you.
or you can do the same with try catch block.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900