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. Datagrid Rows Count

Datagrid Rows Count

Scheduled Pinned Locked Moved Visual Basic
databasetutorialquestion
4 Posts 2 Posters 4 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
    AbsolutFreedom
    wrote on last edited by
    #1

    Hi, I'm creating a windows application for user to input inventory items. I'm using a datagrid for the user input. However, when I'm creating the SQL statement to insert it into the database, I couldn't figure out how to get the datagrid row count. When i'm using datagrid.VisibleRowCount, only the visible items will be counted (therefore added to the DB). How could I get the total row count for datagrid. Anybody? Thanks! :)

    G 1 Reply Last reply
    0
    • A AbsolutFreedom

      Hi, I'm creating a windows application for user to input inventory items. I'm using a datagrid for the user input. However, when I'm creating the SQL statement to insert it into the database, I couldn't figure out how to get the datagrid row count. When i'm using datagrid.VisibleRowCount, only the visible items will be counted (therefore added to the DB). How could I get the total row count for datagrid. Anybody? Thanks! :)

      G Offline
      G Offline
      Gunther Meusburger
      wrote on last edited by
      #2

      hello, why do you need the rowcount? if your datagrid is bound to dataset you just have to call the update-methode of the dataadapter. the dataadapter have to be configured with a selectstatement and the db-table must have a primary key so the dataadapter can generate the insert, update and delete statements. or isn't this your problem..? keep trying

      A 1 Reply Last reply
      0
      • G Gunther Meusburger

        hello, why do you need the rowcount? if your datagrid is bound to dataset you just have to call the update-methode of the dataadapter. the dataadapter have to be configured with a selectstatement and the db-table must have a primary key so the dataadapter can generate the insert, update and delete statements. or isn't this your problem..? keep trying

        A Offline
        A Offline
        AbsolutFreedom
        wrote on last edited by
        #3

        Actually my datagrid is not bound to any dataset. I start the form with an empty datagrid, which let the user to input the data (it look somewhat like microsoft access). So once the user has fill in all the data, the user has to click a button to save the records. To save the records, i need to know how many rows of data the user has entered. Therefore I need to know the number of rows for that datagrid. And the only method that the datagrid has is "VisibleRowCount", which only count the visible rows.

        G 1 Reply Last reply
        0
        • A AbsolutFreedom

          Actually my datagrid is not bound to any dataset. I start the form with an empty datagrid, which let the user to input the data (it look somewhat like microsoft access). So once the user has fill in all the data, the user has to click a button to save the records. To save the records, i need to know how many rows of data the user has entered. Therefore I need to know the number of rows for that datagrid. And the only method that the datagrid has is "VisibleRowCount", which only count the visible rows.

          G Offline
          G Offline
          Gunther Meusburger
          wrote on last edited by
          #4

          it is much easier to handle data with a dataset. you can build the strucure of the dataset in memory and bind it to the grid. i think the grid is not a good container for data, it's just a input/output mask for something like a grid.

          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