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 DataSource: bindingSource or dataSet?

DataGridView DataSource: bindingSource or dataSet?

Scheduled Pinned Locked Moved C#
question
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.
  • M Offline
    M Offline
    mprice214
    wrote on last edited by
    #1

    Hi all, I have a generic question regarding DataGridView. If I have a dataSet with a table, is it best to set the DataSource for the DataGridView as dataSet and the DataMember as the Table in the dataSet? Or should the DataGridView's DataSource be a bindingSource whose DataSource is the dataSet and whose DataMember is the Table in the dataSet? If so, that seems redundant. However, I'm sure there is a reason for doing it this way. Thanks.

    H 1 Reply Last reply
    0
    • M mprice214

      Hi all, I have a generic question regarding DataGridView. If I have a dataSet with a table, is it best to set the DataSource for the DataGridView as dataSet and the DataMember as the Table in the dataSet? Or should the DataGridView's DataSource be a bindingSource whose DataSource is the dataSet and whose DataMember is the Table in the dataSet? If so, that seems redundant. However, I'm sure there is a reason for doing it this way. Thanks.

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

      It's a horses for courses thing IMO. For very, very simple things with little or no user interaction it is probably simpler to bind directly to the dataset. For most other circumstances and in my somewhat limited experience, using a BindingSource gives more control functionality. Some links for BindingSource: BindingSource a closer look[^] BindingSource Class (MSDN)[^]. Just read the Remarks section for reasons that you might want to use a BindingSource. A Detailed Data Binding Tutorial[^]. Any list would be incomplete without a Code Project article. :) Others might disagree and I hope that they offer their opinions.

      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.” Why do programmers often confuse Halloween and Christmas? Because 31 Oct = 25 Dec.

      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