multiple DataGridViews (one per tab) what is proper architecture?
I have a form that will have a tab page. Each tab page will correspond to a ClassID from a datatable.
When the form is loaded, I will obtain a datatable of the distinct ClassID values from the table. The count of distinct ClassIDs can change.
I have built this and it was working in IDE but not as a compiled executable. I was getting a lot of reentrant errors from my DataGridViews.
For each of the rows in the datatable (one for each ClassID) I want to
-obtain a new DataTable from a stored procedure (this part works)
-add a new tab page
-add a DataGridView
-display the stored procedure DataTable in the datagridview
What is the correct way to do this?
I am assuming I need to use BindingSource objects with a DataSource of the stored procedure DataTable. Should the BindingSources be part of a collection?
Re: multiple DataGridViews (one per tab) what is proper architecture?
If you have separate Datatables then it's as easy as DataGridViewx.DataSource = DataTablex
Reentrant problems are far more likely to come from editing or manipulation routines than basic display, however, particularly if you are re-ordering or changing the visible status of columns while references to particular cells are in play. You must check that there is no opportunity for ambiguities in the cell references in any kind of programmatic referencing, editing or value changing of individual cells.
Re: multiple DataGridViews (one per tab) what is proper architecture?
I have been working with DataGridViews for a while and they seem incredibly useful but also incredibly flaky. I'm sure it is just that I am doing things wrong.
In your opinion, any reentrant problems are due to the way I am manipulating the columns/rows? That will help me figure this out. I was thinking I had to start from scratch with my data loading processes.
Re: multiple DataGridViews (one per tab) what is proper architecture?
It seems to keep sporadically when I make the column ReadOnly - it is not consistent. My solution for now is to make the entire DataGridView ReadOnly and that seems to do the trick.
Re: multiple DataGridViews (one per tab) what is proper architecture?
Nope DataGridView ReadOnly does not do the trick.
Fails with Operation is not valid due to the current state of the object.
Moved DataGridView ReadOnly to module where DataGridView is first created. Seems to work so far.