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: got the row value now need the string value

Datagridview: got the row value now need the string value

Scheduled Pinned Locked Moved C#
helpquestioncsharpdatabasevisual-studio
4 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.
  • S Offline
    S Offline
    shwaguy
    wrote on last edited by
    #1

    I know a lot of people ask how to get the row index value in a C# datagridview so this code should help them. But I am now stuck. The data source is created on the fly and is destroyed as soon as it is viewed so I have to retrieve data from the visible datagrid view: I need to get the string value of my known (row, column). Googling and going through the IDE has been no help. How do I do this? int i = adObjectDataGridView.CurrentRow.Index; MessageBox.Show(Convert.ToString(i)); //adObjectDataGridView.//need string value of known row, column shwa guy

    A 1 Reply Last reply
    0
    • S shwaguy

      I know a lot of people ask how to get the row index value in a C# datagridview so this code should help them. But I am now stuck. The data source is created on the fly and is destroyed as soon as it is viewed so I have to retrieve data from the visible datagrid view: I need to get the string value of my known (row, column). Googling and going through the IDE has been no help. How do I do this? int i = adObjectDataGridView.CurrentRow.Index; MessageBox.Show(Convert.ToString(i)); //adObjectDataGridView.//need string value of known row, column shwa guy

      A Offline
      A Offline
      alanteigne
      wrote on last edited by
      #2

      if you know row# = i, and column# = n, try: adObjectDataGridView.Rows[i].Cells[n].Value.ToString()

      S 1 Reply Last reply
      0
      • A alanteigne

        if you know row# = i, and column# = n, try: adObjectDataGridView.Rows[i].Cells[n].Value.ToString()

        S Offline
        S Offline
        shwaguy
        wrote on last edited by
        #3

        Alanteigne, you are the man. It worked great. thank you. shwaguy

        A 1 Reply Last reply
        0
        • S shwaguy

          Alanteigne, you are the man. It worked great. thank you. shwaguy

          A Offline
          A Offline
          alanteigne
          wrote on last edited by
          #4

          no problem!

          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