Home > DeveloperSection > Interviews > How to validate data in C#

Posted on    September-16-2016 5:15 AM

 C# C# 
Ratings:
 1 Answer(s)
  105  View(s)
Rate this:

Barbara Jones

Total Post:19

Points:95
Posted on    September-16-2016 5:15 AM

Data validation in C# 

 

If there is a need to add validation like data can't be empty then following codes can be use after the click button

 

   if (textBox1.Text == string.Empty)

            {

                MessageBox.Show("Please enter the Name");

                return;

            }

 

Output :


 


Modified On Sep-17-2016 12:45:10 AM

Don't want to miss updates? Please click the below button!

Follow MindStick