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 8703603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:54:17+00:00 2026-06-13T02:54:17+00:00

Hey so I have all my code working and it’s fine. But I’d like

  • 0

Hey so I have all my code working and it’s fine. But I’d like to clean it up a little.

At the moment I just have a message box show if there is an error in the input, so it would show “Please check your input”, however I’d like it to show something like “Please check the following: firstname, secondname etc.”

if  ((FirstnameText.Text.Trim().Length == 0) || (SurnameText.Text.Trim().Length == 0)
    || (DateOfBirthText.Text.Trim().Length == 0) || (CourseText.Text.Trim().Length == 0)
    || (MatricNoText.Text.Trim().Length == 0) || (YearMarkText.Text.Trim().Length == 0)
    || (int.Parse(MatricNoText.Text) < 10000 || int.Parse(MatricNoText.Text) > 99999)
    || (int.Parse(YearMarkText.Text) < 0 ||  int.Parse(YearMarkText.Text) > 100))

   {
      errorMessage();
      return;
   }

public void errorMessage()
{
   MessageBox.Show("Please check your input");
}

I know it’s messy, but hey it works

Currently it just outputs that message, is there a simple way to output the specific textbox which has the error?

thanks

  • 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-06-13T02:54:18+00:00Added an answer on June 13, 2026 at 2:54 am

    Splitting up your code would be a start:

    if  ((FirstnameText.Text.Trim().Length == 0){
       errorMessage("firstname is empty");
    }
    
    if (SurnameText.Text.Trim().Length == 0){
       errorMessage("surname is empty");
    }
    

    Get the idea?

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

Sidebar

Related Questions

Hey all, working on a C++ little game, Connect 3. This is just like
Hey all, this is the code i have to check for a day thats
Hey all. Here is the scenario. I have the below code, and I'm needing
Hey all, I have been doing nothing but web development over the last few
Hey all, basically i have an empty AS3 fla file with just the following
Let's say I have the string Hey . I would like to determine all
Hey all i have a JSFiddle that i have been working on with trying
Hey all, I'm working on cleaning up my code from previous semesters. Previously I
Hey all... I've got a jQueryUI tabs implementation that's pretty straightforward and working fine.
Hey all i have created dynamic buttons at runtime and i would like 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.