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. DataGridView - Display Row Numbers on Control

DataGridView - Display Row Numbers on Control

Scheduled Pinned Locked Moved Visual Basic
question
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.
  • R Offline
    R Offline
    RichardBerry
    wrote on last edited by
    #1

    Hi How can I display row numbers on the left hand side of a datagridview control. (i.e. not in the cells)

    R 1 Reply Last reply
    0
    • R RichardBerry

      Hi How can I display row numbers on the left hand side of a datagridview control. (i.e. not in the cells)

      R Offline
      R Offline
      Rupesh Kumar Swami
      wrote on last edited by
      #2

      hi RichardBerry, try following code Dim i As Integer For i = 0 To datagridview1.Rows.Count - 1 datagridview1.Rows(i).HeaderCell.Value = CStr(datagridview1.Rows(i).HeaderCell.RowIndex + 1) Next hope this helps

      Rupesh Kumar Swami Software Engineer, Integrated Solution, Bikaner (India)

      R 1 Reply Last reply
      0
      • R Rupesh Kumar Swami

        hi RichardBerry, try following code Dim i As Integer For i = 0 To datagridview1.Rows.Count - 1 datagridview1.Rows(i).HeaderCell.Value = CStr(datagridview1.Rows(i).HeaderCell.RowIndex + 1) Next hope this helps

        Rupesh Kumar Swami Software Engineer, Integrated Solution, Bikaner (India)

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

        Hi Rupesh Thanks, that does work I was however hoping for somthing automatic. Also if I delete a row, then I will have to catch that event and renumber the rows. Thanks for your help though :)

        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