Click here to Skip to main content
15,920,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Why I am not shown the message box?, I can just see the error in the output "A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll"

C#
private void btnLoadWeigths_Click(object sender, EventArgs e)
      {
          try
          {
              wieghtL = loadNN("Weights.data");
              loadWeigths = true;
              checkWeight();
          }
          catch //(System.IO.FileNotFoundException)
          {
              MessageBox.Show("Wieights.data Not Found");
          }
      }
Posted

you can use something like below :

C#
if (File.Exists(YourFilePath))
{
       wieghtL = loadNN("Weights.data");
       loadWeigths = true;
       checkWeight();
}
else
{
     MessageBox.Show("Wieights.data Not Found");
}
 
Share this answer
 
Are you sure that loadNN does not already have its own try/catch for that purpose? In that case, you might see the exception while debugging depending on your exception configuration Inside Visual Studio.

If you have the whole sopurce code, it should be fairly easy to see in the debugger assume that Visual Studio is configured to break on exceptions (of this type).
 
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