Suppose I don't want to use
if (string.IsNullOrEmpty(textbox1.Text))
{
textbox1.Text = null;
}
for every textbox controls in form, is there a easier way to do it ?
Simple way is Loop through every control, see the below code
foreach (Control C in this.Controls)
{
if (C is TextBox)
{
if (C.Text == "")
{
C.Text = null;
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With