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. Visual Basic
  4. Filling a DataGrid without a DataSource

Filling a DataGrid without a DataSource

Scheduled Pinned Locked Moved Visual Basic
helpquestion
3 Posts 3 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.
  • F Offline
    F Offline
    ford86
    wrote on last edited by
    #1

    Can someone please help me filling a DataGrid without a DataSource. I'm used to work with a component called the True DBGrid made by ComponentOne for VB6, and it was a walk in the park to change the cells' value. Surely there's a way to modify the values without a source, right? Thanks in advance!

    R D 2 Replies Last reply
    0
    • F ford86

      Can someone please help me filling a DataGrid without a DataSource. I'm used to work with a component called the True DBGrid made by ComponentOne for VB6, and it was a walk in the park to change the cells' value. Surely there's a way to modify the values without a source, right? Thanks in advance!

      R Offline
      R Offline
      RichardBerry
      wrote on last edited by
      #2

      I Don't know if I understand your question correcly, but if you are using VS2005, and a DataGridView control, you can do this: 'Drop the control on your form 'Add two columns Me.DataGridView1.Columns.Add("Col1", "FirstColName") Me.DataGridView1.Columns.Add("Col2", "SecondColName") 'Add some rows - 5 in this case Me.DataGridView1.Rows.Add(5) 'Modify the Data in the control Me.DataGridView1.Item(0, 0).Value = "Hello" 'Row 0, Column 0 Me.DataGridView1.Item(0, 1).Value = "Dude" 'Row 1, Column 0

      1 Reply Last reply
      0
      • F ford86

        Can someone please help me filling a DataGrid without a DataSource. I'm used to work with a component called the True DBGrid made by ComponentOne for VB6, and it was a walk in the park to change the cells' value. Surely there's a way to modify the values without a source, right? Thanks in advance!

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        You could do how Richard described, but if you're going to save the data in the grdi, you'd be better off binding the grid to a DataTable you create. The DataTable object can save, and load, the data into/from an XML file without a pile of code on your part.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        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