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. databinding and controls

databinding and controls

Scheduled Pinned Locked Moved C#
questionannouncement
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.
  • H Offline
    H Offline
    Hubert
    wrote on last edited by
    #1

    I have two controls on a form - checkBox1 and textBox1. When user "checks" checkBox1, textBox1 becomes visible. Looks pretty simple :o) 1. without databinding: textBox1.visible=checkBox1.checked This works great. 2. let's play with some data in dataset: I have bound "Checked" property of checkBox1 to a field in DataSet/DataTable. This field is also bounded to textBox1.visible property. Result: checkBox1 needs to lost focus to update data in dataTable, so user needs to "check" and next click into some other control. What should i do to make it working properly (immediately)? thanks h. btw: I have also tryed to force focus changes on the form (this.select(...)). The checkBox needed 2 mouse clicks to synchronize its state with dataset and since then, everything was fine :o)

    L 1 Reply Last reply
    0
    • H Hubert

      I have two controls on a form - checkBox1 and textBox1. When user "checks" checkBox1, textBox1 becomes visible. Looks pretty simple :o) 1. without databinding: textBox1.visible=checkBox1.checked This works great. 2. let's play with some data in dataset: I have bound "Checked" property of checkBox1 to a field in DataSet/DataTable. This field is also bounded to textBox1.visible property. Result: checkBox1 needs to lost focus to update data in dataTable, so user needs to "check" and next click into some other control. What should i do to make it working properly (immediately)? thanks h. btw: I have also tryed to force focus changes on the form (this.select(...)). The checkBox needed 2 mouse clicks to synchronize its state with dataset and since then, everything was fine :o)

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      This has popped up several times this week. It is rather annoying (not u, the problem :)) You will need to do something like this depending on your databinding: control.DataBindings[0].BindingManagerBase.EndCurrentEdit(); I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02

      H 1 Reply Last reply
      0
      • L leppie

        This has popped up several times this week. It is rather annoying (not u, the problem :)) You will need to do something like this depending on your databinding: control.DataBindings[0].BindingManagerBase.EndCurrentEdit(); I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02

        H Offline
        H Offline
        Hubert
        wrote on last edited by
        #3

        You're right two times in one answer: 1. This problem is REALLY annoying. :o) 2. This method works well - I have tested 3 different binding modes. There is just one small thing - it needs two more clicks on checkbox to "synchronize". Should I open the row for editing? I have tried to use BeginEdit() method on current row, but there was no difference. I think, that may be a point, but have no idea how to solve it. Thanks for help h.

        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