Selecting a cell from a datagrid

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • twigboy
    New Member
    • Mar 2007
    • 12

    Selecting a cell from a datagrid

    Hey everyone,
    I have a datagrid that I would like to get the value of a cell that a user clicks on. Say a user clicks on the first row can I get the value of the cell in the first column, or any column for that matter.
    Thanks
  • computerenigma13
    New Member
    • Mar 2007
    • 36

    #2
    For one thing you will need details view and a few SQL queries to make it work
    i am searching for my code i have for one if i find it i will post it for you so you can see

    Comment

    • twigboy
      New Member
      • Mar 2007
      • 12

      #3
      Thanks for looking.
      I currently do have the details view for the cell value I want from the datagrid and I will be using sql queries to get the data.

      Comment

      • computerenigma13
        New Member
        • Mar 2007
        • 36

        #4
        i will have to look when i get home cause i m at wokr right now and my program is at home i will pm you with the code after i find it

        Comment

        • Mahesh83
          New Member
          • Feb 2007
          • 25

          #5
          Originally posted by computerenigma1 3
          i will have to look when i get home cause i m at wokr right now and my program is at home i will pm you with the code after i find it
          HI

          On DataGridView1_C ellDoubleClick event paste this code it will definately work

          dim stdata
          stdata = datagridmainfor m.CurrentRow.Ce lls.Item(0).Val ue.ToString()

          In this on datagrid view the first column i.e item(0) value comes in stdata


          Cheers
          Mahesh

          Comment

          • twigboy
            New Member
            • Mar 2007
            • 12

            #6
            sweet thanks mahesh. I am actually using c# but I think they should have the same properties.


            Originally posted by Mahesh83
            HI

            On DataGridView1_C ellDoubleClick event paste this code it will definately work

            dim stdata
            stdata = datagridmainfor m.CurrentRow.Ce lls.Item(0).Val ue.ToString()

            In this on datagrid view the first column i.e item(0) value comes in stdata


            Cheers
            Mahesh

            Comment

            • twigboy
              New Member
              • Mar 2007
              • 12

              #7
              Alright I just tried it with C# but it does not have an Item() property.
              Any ideas?

              Comment

              • twigboy
                New Member
                • Mar 2007
                • 12

                #8
                WooooWhooo.
                I got it with datagridview.cu rrentrow.cells[0].value
                Thanks for the help

                Comment

                Working...