I have some code below:
SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);
command.Parameters.AddWithValue("@company", txtCompany.Text);
command.Parameters.AddWithValue("@server", txtServer.Text);
command.Parameters.AddWithValue("@username", txtUserName.Text);
command.Parameters.AddWithValue("@password", txtPassword.Text);
How do i validate empty textboxes making sure that the textboxes are alway populated?
I have tried:
if (string.IsNullOrEmpty(txtCompany.Text))
{
//do work here
}
else
{
}
However im not sure how i can assign ALL text boxes like this? in a cleaner way which limits the number of lines of code i have to write?