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. dataGridView and columns.add

dataGridView and columns.add

Scheduled Pinned Locked Moved C#
csshelpquestionannouncement
2 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.
  • S Offline
    S Offline
    Saamir
    wrote on last edited by
    #1

    Hi guys, I am in a bit of dilemma and need some help please!!! Here is my scenario I have a couple datagridviews which populate data from a dataset I have cell_click event which is used to move data from one grid to another. If there is no empty cell in my grid2 then I add a column in the cell click event and populate data into the new column cell. I also have a drag drop event which I use to move data across grid2, after I do the cell click for some reason it doesn't let me do drag drop, it says object reference not set to an instance of an object in the new cell where the data is being dropped. My assumption is that after I add the column, for some reason there is a null reference on all cells except the added data cell. How do I add the column, update the dataset and the datagridview without reloading the data in the grid. Hope I make sense. Please helppppp

    Sameer

    H 1 Reply Last reply
    0
    • S Saamir

      Hi guys, I am in a bit of dilemma and need some help please!!! Here is my scenario I have a couple datagridviews which populate data from a dataset I have cell_click event which is used to move data from one grid to another. If there is no empty cell in my grid2 then I add a column in the cell click event and populate data into the new column cell. I also have a drag drop event which I use to move data across grid2, after I do the cell click for some reason it doesn't let me do drag drop, it says object reference not set to an instance of an object in the new cell where the data is being dropped. My assumption is that after I add the column, for some reason there is a null reference on all cells except the added data cell. How do I add the column, update the dataset and the datagridview without reloading the data in the grid. Hope I make sense. Please helppppp

      Sameer

      H Offline
      H Offline
      Henry Minute
      wrote on last edited by
      #2

      Without seeing the relevant code, and only relevant code please, it is almost impossible to give a sensible answer. Except to say that adding a column to the DataGridView, does NOT add a column to the underlying DataTable/DataSet, which may be where the null reference exception is occurring.

      Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

      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