views:

815

answers:

1

Hello Every one :D Description :

I'm using a Global DataGridView which is been created once , then I'm sharing that grid ByRef on multiple User controls , the strange thing is -> first control adding or Initializing that grid will draw it all others controls will not draw it (For sure and I know why Its not drawing)

Question : how can I force the global datagridview to redraw in every User Control that I have ..!!?

Mentioning that I'm populating the DataGridView Manully with out using data member / Data source .

Thank you .

+1  A: 

OK, that is really quite dangerous. Controls are not meant to be parented by multiple forms / controls. You would do much better to share the data (via an observable collection, such as BindableList<T>, or DataView if you are so inclined). Obviously this means setting the data-member/data-source, or doing all the updates (to all the grids) yourself.

But seriously; DataGridView (nor any other control AFAIK) is not meant to be used like that.

For info, assuming that VB's ByRef is comparable to C#'s ref, then you don't need that anyway... you are already only passing the reference (by value). But that isn't important since it won't work either way.

Marc Gravell