I have a custom control that is basically a DataGridView docked inside a split panel with a rich text box on the other half. This control is docked in a tab page in my main program.
Here is some relevent code
public LogReader()
{
InitializeComponent();
using (var conn = new SqlConnection(ConnectionString))
using (var ada = new SqlDataAdapter("SELECT [PK_JOB],[CLIENT_ID],[STATUS],[LOG_NAME],dt FROM [ES_HISTORY] inner join [es_history_dt] on [PK_JOB] = [es_historyid]", conn))
{
conn.Open();
Logs = ada.FillSchema(new DataTable(), SchemaType.Source);
}
bs.DataSource = Logs;
}
private DataTable Logs;
public void ChangeClinic(string ClientID)
{
using (var conn = new SqlConnection(ConnectionString))
using (var ada = new SqlDataAdapter("SELECT [PK_JOB],[CLIENT_ID],[STATUS],[LOG_NAME],dt FROM [ES_HISTORY] inner join [es_history_dt] on [PK_JOB] = [es_historyid] where client_id = '" + ClientID + "' Order by dt desc", conn))
{
conn.Open();
Logs.Clear();
ada.Fill(Logs);
}
rtbLog.Clear();
}
If I call ChangeClinic
while the DGV is visible everything works fine. But if you are focused on another tab in the main program and you call ChangeClinic
and there are more rows than can be displayed on the screen the scroll bar will act like it is set to inactive. I can interact with the DGV fine in every other way (selecting cells, using the arrow keys to navigate) but I have to make another call to ChangeClinic
while the DGV is viable to get my scroll bar back from being grayed out.
Anyone heard of anything similar to this happening?