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

  • SEARCH
  • Home
  • 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 6914749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:23:17+00:00 2026-05-27T09:23:17+00:00

Now I have a sub to validate a bunch of textboxes and combo boxes.

  • 0

Now I have a sub to validate a bunch of textboxes and combo boxes.

I previously used many IF statements to validate and pop up different messageboxes and Exit Sub in every IF statement.

But I heard that too many Exits will decrease the efficiency and they were not recommended to use. Instead, nested IF is better because it will let the process naturally go to the end.

Then I found out that if I use nested IF, it will be hard to read, since messageboxes are all separated from conditions.

I have no software development experience. So my question is: in the real projects, which style will you choose?

  • 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-27T09:23:17+00:00Added an answer on May 27, 2026 at 9:23 am

    You should use what is more readable and what you agree with your team.

    As for having many Exits decreasing performance – I don’t know if that is true, but even if it was, I would expect it to be such a minimal amount to me a micro-micro-optimization. This is something you can easily test yourself – run both types of code in a loop (millions/billions of times) and measure how much time each took using the StopWatch class.

    I personally find multiple returns easier to read in this specific case and it is my usual style.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a sub with this signature Public Sub Save(ByVal obj As IPta) now
Right now, I have code that looks something like this: Private Sub ShowReport(ByVal reportName
I am trying to create a sub navigation. Right now I have two subnav.
I now have it set up so that when people go to a thank
I now have a running Java program which only lacks of the final step,that
Modern ATL/MFC applications now have access to a new shared pointer class called CAutoPtr,
in /usr/local i now have two mysql folders: mysql-5.1.34-osx10.5-x86 mysql-5.1.37-osx10.5-x86_64 is it possible to
The javascript code I now have can toggle a single row of data. Whether
Following on from this question I now have code that can attach to a
With help from you guys I now have a script that works like a

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.