Results 1 to 5 of 5

Thread: multiple DataGridViews (one per tab) what is proper architecture?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2013
    Posts
    10

    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?
    Last edited by wwagnon; Jan 31st, 2013 at 05:57 PM.

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    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.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2013
    Posts
    10

    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.

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2013
    Posts
    10

    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.

  5. #5

    Thread Starter
    New Member
    Join Date
    Jan 2013
    Posts
    10

    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.
    Last edited by wwagnon; Feb 1st, 2013 at 11:06 AM. Reason: more info

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width