Re: Stopping error message in VB .NET

Tech-Archive recommends: Speed Up your PC by fixing your registry



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


.



Relevant Pages

  • Re: Bad habits of GOTO-using programmers
    ... The fact that it contains only the word EXIT confirms its function. ...     perform section-a ... The results of the execution of overlapping PERFORM statements are ...     The exit to main is destroyed by the second perform of a-x. ...
    (comp.lang.cobol)
  • Re: Stopping error message in VB .NET
    ... until you are successful. ... >> classical exception window. ... but I must not allow to continue the program execution. ...
    (microsoft.public.dotnet.general)
  • Re: CRC reverse engineering
    ... exit. ... She'd rather allege still than name with Mike's continued ... execution. ... When doesn't Allahdad need at least? ...
    (sci.crypt)
  • Re: Bad habits of GOTO-using programmers
    ... The fact that it contains only the word EXIT confirms its function. ...     perform section-a ... The results of the execution of overlapping PERFORM statements are ...     The exit to main is destroyed by the second perform of a-x. ...
    (comp.lang.cobol)
  • Re: Most dependable way to run system commands
    ... Eventually I'd like to bring the execution of a few system commands ... specific execution issue (it dealt more with executing Perl code)). ... Unix and many similar systems, the exit status is an integer, with 0 ... variable after running a command via system or backticks. ...
    (perl.beginners)