Wednesday, December 3, 2014

How to check which textBox is empty ,checkBox is not checked

Give each input control a unique x:Name in the XAML, e.g:



<TextBox x:Name="t1"/>
<CheckBox x:name="c1" />



You could then reference each control by its name:



if(t1.Text == "some text...")
{
//do this
}
else
{
//do that...
}

if(c1.IsChecked == true)
{
//checkbox is checked...do this
}
else
{
//do that...
}

if(string.IsNullOrEmpty(t1.Text))
{
//t1 is empty...
}



Please remember to mark helpful posts as answer and/or helpful.

No comments:

Post a Comment