Re: Stopping error message in VB .NET
- From: "Jerry Camel" <rlrcstr@xxxxxxx>
- Date: Fri, 8 Jul 2005 14:17:14 -0400
You could put the code in the try block. It won't get executed if the catch
is invoked before it is hit.
You could also just exit the Sub or Function using: Exit Sub or Exit
Function.
When you say you want the program to stop I'm guessing you mean you want
that particular funtion to stop, but that the user may choose to try
something else...?
Otherwise, use the Application.Exit as noted in a previous post.
Jerry
"Toni" <tonilounavarro@xxxxxxxxx> wrote in message
news:1d7fcbe6.0507070846.40a9b178@xxxxxxxxxxxxxxxxxxxxx
> Hello
>
> I'm a newbie in VB .NET and I'd like to accomplish a (I think) very
> simple task.
>
> What I want to do is throw an error message to the user whenever
> something happens. The main point is that the message must stop the
> code execution, but it sholud not close the application nor show the
> classical exception window (the one with JIT compiler information).
>
> That is, I'd like to make something like
>
>
> Dim L_XMLConfigurationFile As XmlDocument = New XmlDocument
>
> Try
> L_XMLConfigurationFile.Load("c:\temp\TestFile.xml")
> Catch ex As Exception
> MyErrorFunction("The file <TestFile.xml> does not
> exists.")
> End Try
>
> MessageBox.Show("We got there...")
>
>
> and I want to get an error window telling the user that the file does
> not exists, but I must not allow to continue the program execution.
> That is, the program should never get to the MessageBox.Show("We got
> there...") line if the file does not exists.
>
> The exception handler mechanism shows a window that allows the user to
> continue execution, so it does not fit my needs.
>
> Some languages have an ERROR function that stops the execution where
> it is called, and I want just that.
>
> Any ideas?
>
>
> Thanks,
>
> Toni
.
- Follow-Ups:
- Re: Stopping error message in VB .NET
- From: Jerry Camel
- Re: Stopping error message in VB .NET
- From: tonilounavarro
- Re: Stopping error message in VB .NET
- References:
- Stopping error message in VB .NET
- From: Toni
- Stopping error message in VB .NET
- Prev by Date: What kind of battery UPS - shutdown software to use for IIS 5 or IIS 6?
- Next by Date: WMI Question
- Previous by thread: Re: Stopping error message in VB .NET
- Next by thread: Re: Stopping error message in VB .NET
- Index(es):
Relevant Pages
|