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. .NET (Core and Framework)
  4. DataGridView addingnew but no data

DataGridView addingnew but no data

Scheduled Pinned Locked Moved .NET (Core and Framework)
wpfwcfcombusinesshelp
2 Posts 1 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.
  • A Offline
    A Offline
    Arkett
    wrote on last edited by
    #1

    I have a strange little problem with a bound datgridview. The DGV is on an unbound form but is itself bound to a bindingsource which is in turn bound to a bindinglist(of T) which encapsulates a list of business objects (with me so far.) Ok so when the user clicks an empty row in the DGV the addingnew event is fired immediately - kind of odd behaviour that I thought. The user then types some text into the new rows first field. When I check the contents of the bindinglist a new object has indeed been added but does not contain the text that was typed; in short it is completely blank. If you then reload the form move to the blank row added previously and enter the text again then the empty object in the binding list is correctly updated. I hope you have all been able to follow this explanation and I hope even more that someone can explain what is going on.

    http://www.ViSYNERGY.com End of Line.

    A 1 Reply Last reply
    0
    • A Arkett

      I have a strange little problem with a bound datgridview. The DGV is on an unbound form but is itself bound to a bindingsource which is in turn bound to a bindinglist(of T) which encapsulates a list of business objects (with me so far.) Ok so when the user clicks an empty row in the DGV the addingnew event is fired immediately - kind of odd behaviour that I thought. The user then types some text into the new rows first field. When I check the contents of the bindinglist a new object has indeed been added but does not contain the text that was typed; in short it is completely blank. If you then reload the form move to the blank row added previously and enter the text again then the empty object in the binding list is correctly updated. I hope you have all been able to follow this explanation and I hope even more that someone can explain what is going on.

      http://www.ViSYNERGY.com End of Line.

      A Offline
      A Offline
      Arkett
      wrote on last edited by
      #2

      Actually I have now solved this - at about two in the morning, I worked it out. Calling endedit on the bindingsource component doesn't (for reasons best known to MS,) pass through to the DGV that's bound to it. So to make my code work correctly I have to call endEdit on the DGV first and then call endEdit on the bindingsource. I call this very strange behaviour, but at least now I can move on.

      http://www.ViSYNERGY.com End of Line.

      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