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. Database & SysAdmin
  3. Database
  4. DataGrid and DataGridView

DataGrid and DataGridView

Scheduled Pinned Locked Moved Database
csharpcsstoolshelptutorial
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.
  • B Offline
    B Offline
    Blekk
    wrote on last edited by
    #1

    Hi, I have got the Apress book Beginning C# Databases: from Novice to Professional, and have been very pleased with it, But because it was written before Microsoft Visual C# 2005 came out, some things are a bit out of date. I have managed to get around most of them except this one: It tells me to add a DataGrid to the designer view, but all I could find was DataGridView, and after some scripting, I have to "Bind the data grid at run time" using the script: dataGrid1.SetDataBinding(dataset1, "employees"); I understand what the code is doing but the class DataGridView does not have a SetDataBinding function and so do not know how to bind the DataGridView1 object to the dataset. Please help. Thanks, Any reply is appreciated. I will also post this in the C# section

    S 1 Reply Last reply
    0
    • B Blekk

      Hi, I have got the Apress book Beginning C# Databases: from Novice to Professional, and have been very pleased with it, But because it was written before Microsoft Visual C# 2005 came out, some things are a bit out of date. I have managed to get around most of them except this one: It tells me to add a DataGrid to the designer view, but all I could find was DataGridView, and after some scripting, I have to "Bind the data grid at run time" using the script: dataGrid1.SetDataBinding(dataset1, "employees"); I understand what the code is doing but the class DataGridView does not have a SetDataBinding function and so do not know how to bind the DataGridView1 object to the dataset. Please help. Thanks, Any reply is appreciated. I will also post this in the C# section

      S Offline
      S Offline
      smjp
      wrote on last edited by
      #2

      first create a dataset then in page_load event type this for windows application adapter1.Fill(dataset1,"employees"); dataGridView1.DataSource = dataset1.Tables["employees"] for web application gridview1.datasource=dataset1.Tables["employees"] gridview1.databind()

      this is code maker

      B 1 Reply Last reply
      0
      • S smjp

        first create a dataset then in page_load event type this for windows application adapter1.Fill(dataset1,"employees"); dataGridView1.DataSource = dataset1.Tables["employees"] for web application gridview1.datasource=dataset1.Tables["employees"] gridview1.databind()

        this is code maker

        B Offline
        B Offline
        Blekk
        wrote on last edited by
        #3

        thanks for the help, But I found out how to do it another way before your post: dataGridView.DataBindings.Add("datasource",dataSet1,"customers");

        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