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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T11:53:58+00:00 2026-05-19T11:53:58+00:00

I want to display my validation error messages in the MessageBox. I have Four

  • 0

I want to display my validation error messages in the MessageBox. I have Four TextBoxes and One Button control. When I click the Button Control, the TextBoxes without the text to be shown in the MessageBox. I have almost done this, but the problem is When I click the Button, the MessageBox is opened as a minimized window. So it is difficult for the end user to realize. I want to display the MessageBox to the user when button clicks.

Here is my code, In the Button Click Event

ErrorMsg="";

if (TextBox1.Text == "")
{
    ErrorMsg += "Name is required!";
    ErrorMsg += "\n";
}
if (TextBox2.Text == "")
{
    ErrorMsg += "Address is required!";
    ErrorMsg += "\n";
}
if (TextBox3.Text == "")
{
    ErrorMsg += "Phone No. is required!";
    ErrorMsg += "\n";
}
if (TextBox4.Text == "")
{
    ErrorMsg += "City is required!";
    ErrorMsg += "\n";
}
if (ErrorMsg.Length == 0)
{
     //Some Code
}
else
{
    MessageBox.Show(ErrorMsg, "Existing Address", MessageBoxButtons.OK, MessageBoxIcon.Error);
}

Thanks in advance…

  • 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-19T11:53:59+00:00Added an answer on May 19, 2026 at 11:53 am

    You cannot use the Windows MessageBox in an ASP.NET application. It just doesn’t make sense. An ASP.NET spits HTML/javascript/CSS so that’s what you should be using to inform the user that something went wrong. So for example in an ASP.NET application you could use the RegisterStartupScript method to inject javascript into the page which will execute when the page is loaded and use the alert function:

    ScriptManager.RegisterStartupScript(this, GetType(), "error", "alert('oops');", true);
    

    Other more conventional techniques to perform validation in an ASP.NET application involve using the validation controls.

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

Sidebar

Related Questions

I have a multi-lingual page where I want to display form validation error in
I want the maxlength validation of jQuery validate to display an error message like
I want to display the error message generated by jQuery validation plugin at a
In JSF you can display validation error's using <h:messages /> . But what I
Im trying to display error messages for the jquery validator plugin(the bassistance one) as
I have a simple quiz application and I want display a nice timer /
I have db with this table (TableToDo): http://goo.gl/NlTEk I want display all records in
I have a button known as Prepare Questions. Now when I click on this
I have a custom error script that displays custom error messages on a page
I want to display an error message on an Android app screen after some

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.