Friday, July 13, 2012

To check is the Text Property has some value inside of it, and its not null, - C#


if(!String.IsNullOrEmpty(textBox.text)
{
   //code here
}
else
   MessageBox.Show(Please insert some text...");


//or:
if(textBox.Text != Stirng.Empty)
{
   //code here
}
else
   MessageBox.Show(Please insert some text...");

No comments:

Post a Comment