TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Kevin Davis
NA
52
51k
Error handling
Aug 8 2011 12:20 PM
Hello everyone,
I have a several subroutines inside another sub that runs some error checking, and if none of those errors occur, i would like the containing sub to execute, but if any of the other errors occur, I want the containing sub to exit. I'm having a problem using the "exit sub" statement. It still allows a popup message to happen when I don't want it to. Example:
Try
If txtAddress.text = "" then
MsgBox("Please enter a valid address.")
End If
If txtCity.Text = "" Then
MsgBox("Please enter a city.")
End if
If txtState.Text = "" Then
MsgBox("Please enter a state.")
End If
Catch ex as Exception
msgbox(ex.Message)
End try
If none of these occur then I would like the routine to: Msgbox("Your location has been saved.")
Otherwise, I don't want the "Your location has been saved" msgbox to appear. In other words, if any of the three errors occur, exit the sub and show no popup, otherwise show saved popup.
Thanks in advance.
Reply
Answers (
1
)
Sending/Receiving PictureBox Image in C# To/From Microsoft Access database
Help with generating random numbers.