Answer the question
In order to leave comments, you need to log in
Windows Forms, how do I access form elements from another class?
Let's say I have a method like this
public async void Updated()
{
if (!string.IsNullOrEmpty(UpdateMagazinTB.Text) && !string.IsNullOrWhiteSpace(UpdateMagazinTB.Text) &&
!string.IsNullOrEmpty(StoreNameTB.Text) && !string.IsNullOrWhiteSpace(StoreNameTB.Text))
{
SqlCommand sqlCommand = new SqlCommand("UPDATE [Stores] SET [StoreName][email protected] WHERE [StoresId][email protected]", sqlConnection);
sqlCommand.Parameters.AddWithValue("Id", UpdateMagazinTB.Text);
sqlCommand.Parameters.AddWithValue("Name", StoreNameTB.Text);
await sqlCommand.ExecuteNonQueryAsync();
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question