Results 1 to 3 of 3

Thread: [RESOLVED] Getting value of a datagridview

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2010
    Location
    San Marcos, TX
    Posts
    177

    Resolved [RESOLVED] Getting value of a datagridview

    I have a datagridview with this example data:

    Headers -> client_id | name
    Data: 1 | John
    2 | Joe
    3 | Jim

    If the user selects the row containing "Joe", how do I get the value in the client_id row which is "2"?

    Thanks!

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: Getting value of a datagridview

    try this:

    vb Code:
    1. Private Sub DataGridView1_CellEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEnter
    2.     MsgBox(DataGridView1.CurrentRow.Cells(0).Value)
    3. End Sub

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2010
    Location
    San Marcos, TX
    Posts
    177

    Re: Getting value of a datagridview

    Worked thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width