Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. 'Sharing' a bindingsourse with a form and a usercontrol on that form

'Sharing' a bindingsourse with a form and a usercontrol on that form

Scheduled Pinned Locked Moved C#
csharpcsswpfwinformswcf
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Glen Harvy 0
    wrote on last edited by
    #1

    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

    M 1 Reply Last reply
    0
    • G Glen Harvy 0

      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

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      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

      G 1 Reply Last reply
      0
      • M Mycroft Holmes

        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

        G Offline
        G Offline
        Glen Harvy 0
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups