Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 770479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:30:25+00:00 2026-05-14T18:30:25+00:00

I have programmed a sub procedure that will be called in the main procedure

  • 0

I have programmed a sub procedure that will be called in the main procedure (called by mainForm event), to validate the inputs before the main calculation. Now I’m searching for a way to cancel the calculation and refocus the mainForm if some inputs are mismatched. I think it’s unnecessary to use the Try-Catch statement to trap the error from calculation because I know its source and it should be prevented for the sake of code performance. Does someone have a solution this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T18:30:25+00:00Added an answer on May 14, 2026 at 6:30 pm

    If you want to leave a subroutine early you just need to say Return.

    Edit.

    It sounds like you’re calling a method that calls another method. Have the second method return a Boolean indicating whether the input is valid. Something like this:

    Public Sub CheckMainForm()
        'First validate the input
        If Not IsInputValid() Then Return
        'Next do the rest of your work
    End Sub
    Public Function IsInputValid() As Boolean
        'Do input validation, if at anypoint something is wrong return false
        If Not IsNumeric(txtAge.Text) Then Return False
        If Not IsValidEmail(txtEmail.Text) Then Return False
        Return True
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have never programmed in visual basic before and my boss just told me
I have 10 dice that are all programmed the same as D1. D1 =
I have programmed with procedural style a lot before and in these few months
I have programmed an embedded software (using C of course) and now I'm considering
I have programmed a Neural Network in Java and am now working on the
We have had the unenviable happen: various master documents refer to sub-documents that are
I have a form load sub routine here and the problem is that the
I have programmed a shopping list. The footer contains buttons for actions on a
I have programmed an emulator, but I have some doubts about how to organizate
I have programmed in HTML, Java, CSS, C++, VB, an Python. I'm looking to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.