private void btnSaveInformation_Click(object sender, EventArgs e)
{
foreach (Control child in Controls)
{
if (child is TextBox)
{
TextBox tb = child as TextBox;
if (string.IsNullOrEmpty(tb.Text))
{
tb.Text = @"N/A";
}
}
}
//var bal = new StudentBal
//{
// FirstName = txtFirstName.Text
//};
//bal.InsertStudent(bal);
}
What I want to achieve is for the system to check if there is any blank checkbox, and I have numerous in the form, and if it is blank, then assign a value of "N/A". What am I doing wrong with the codeI have? Thank you.