So I have 5 buttons to set to the visibilty to false. However I cant do it in the class for the designer I need to do it in this class. I'm not sure if I should pass the buttons or if theres a better way? But this is where the data grid loads
public static void CostSQL(string connstring, string passableQuery, IEdmVault7 vault, int ID, IEdmFolder5 Folder)
{
try
{
SqlConnection con = new SqlConnection(connstring);
con.Open();
//concat later to optimize code for universal use by passing variable quote
SqlCommand cmd = new SqlCommand(passableQuery, con);
DataTable rTbl = new DataTable();
rTbl.Load(cmd.ExecuteReader());
SQLResultSelector RSel = new SQLResultSelector(rTbl, vault, ID, "c", Folder);
RSel.ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show("Something happend during your connection to SQL error : " + ex.Message);
}
}
Consider an event where if a condition is met, set visibility of buttons.
A conceptual example, pass true or false based on if weekday.
Then in the form subscribe to the event, in form load perhaps.
Code in the event, decide what to do...