Link to home
Start Free TrialLog in
Avatar of Victor  Charles
Victor CharlesFlag for United States of America

asked on

Help with debugging application

Hello,

How do you set VS 2010 to display the error message when an error is encountered while running your code? Presently when there is an error the form is displayed with no error messages.

Thanks,

Victor
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

can we get more details? You surely have a Try ... Catch somewhere that silently get rid of the error.
You need to have a label or literal control...some control on your form to actually display the errors.

For example, if you have this in your aspx page
<asp:Label runat="server" Id="msg" />

When there's an error in your form, you do something like this
msg.Text = "There's an error".

You have to trap the error in your code behind.

This is just one way of doing it. You can do it other ways depending on your code.
Eric, you and I posted at the same time. I've been using this method you have for years...for different projects:

http://www.emoreau.com/Entries/Articles/2008/11/Passing-arguments-to-an-application-startup.aspx
Camillia, how do you know it is a web app?
>>Presently when there is an error the form is displayed with no error messages.

Erm - that sounds like my form is showing correctly but there isn't an error.  Why does my code work?  In other words how do you know there is an error?
Agree Eric. I made an assumption.
Avatar of Victor  Charles

ASKER

Hi,

I am trying to avoid using on error Goto, used to receive error message but not certain what setting was removed.
Thanks.
>>on error Goto...

Unless I am totally mistaken that isn't part of .net in VB.Net error handling possibilities.
What programming language are you using?
VB.NET
@Andy
Unless I am totally mistaken that isn't part of .net in VB.Net error handling possibilities.
I'm afraid you are (though it's not recommended)    ; )

https://msdn.microsoft.com/en-us/library/5hsw66as.aspx
@kaufmed for the info.
Thanks - I'm usually code in C++/C# or VBA.  (Where there is a goto that is to be avoided if at all possible as a rule of thumb)
Victor, your latest comment doesn't help much. We know it is VB.Net but is it Web, WPF, WinForms, ....?

Do you have Try..Catch that swallow the error?

Do you know the code that you are expecting it to throw an error?
It is a Windows Form.
I am using on error goto instead of try catch.
The error occurs on conn.open.
Thanks
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks, changed to try catch. Do i need to import  any files or add anything  in reference  section? Trying to compare both apps but can't  find any differences  so far.
no references needed it is part of the core framework