End Google Ads 201810 - BS.net 01 -->
hi i just want to display all empty fieldnames that are not filled up by the user
but my code has this errorer ' use of unassigned local variable 'messEmptyField' ; how can i fix this
private void btnSave_Click(object sender, EventArgs e)
{
string[] FieldName = { "Lastname", "Firstname", "Address", "Model", "Trouble Reported" };
string messEmptyField;
int i = 0;
foreach (Control ctrl in groupBox1.Controls)
{
TextBox txt = ctrl as TextBox;
if (txt.Text == string.Empty)
{
messEmptyField += FieldName[i]; //error use of unassigned local variable 'messEmptyField'
}
i++;
}
MessageBox.Show(messEmptyField + "please filled up all");
dtDateLog.Focus();
return;
}
مواقع النشر (المفضلة)