'Sharing' a bindingsourse with a form and a usercontrol on that form
-
Hi, I have a winform that has a grid linked to a bindingsource. The winform also has a usercontrol on it that also contains databound data linked to the same datatable but via a different bindingsource. There is a definite need to have the separate usercontrol although life would be much easier without it . The usercontrol is loaded onto the winform as a module contained within the winforms tab pages collection. Anyhow, what I need to do is use the winforms grid as the navigator for the usercontrols binding source. I have tried everything I can think of, the 'easiest' being to change a static variable on the usercontrol and then have a static method on the usercontrol change the bindingsource position but the bindingsource itself needs to be made static and that's not possible as far as I know? Can someone come up with some code that will do the trick. Thanks.
Glen Harvy
-
Hi, I have a winform that has a grid linked to a bindingsource. The winform also has a usercontrol on it that also contains databound data linked to the same datatable but via a different bindingsource. There is a definite need to have the separate usercontrol although life would be much easier without it . The usercontrol is loaded onto the winform as a module contained within the winforms tab pages collection. Anyhow, what I need to do is use the winforms grid as the navigator for the usercontrols binding source. I have tried everything I can think of, the 'easiest' being to change a static variable on the usercontrol and then have a static method on the usercontrol change the bindingsource position but the bindingsource itself needs to be made static and that's not possible as far as I know? Can someone come up with some code that will do the trick. Thanks.
Glen Harvy
I am working on something that passes a DataGridView to a used control which then accesses the bindingsource of the DGV. I do this by having a public property on the UC of type DataGridView and passing the DGV on form load. I imagine you could do the same with a bindingsource.
Never underestimate the power of human stupidity RAH
-
I am working on something that passes a DataGridView to a used control which then accesses the bindingsource of the DGV. I do this by having a public property on the UC of type DataGridView and passing the DGV on form load. I imagine you could do the same with a bindingsource.
Never underestimate the power of human stupidity RAH
Yes - thanks for that. I reworked http://msdn.microsoft.com/en-us/library/ms404320.aspx[^] and passed the bindingsource to the control. Works well. Regards,
Glen Harvy