Hi Friends

I am using a datagridview, there are four columns in that, & on fourth cell i have a button field, when i click on that i want to get the text of item(0) of selected row.

please help me to solve this

Recommended Answers

All 2 Replies

HINT : :)

Dim sel_row_index As Integer
Dim sel_col_index As Integer

Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
        sel_row_index = e.RowIndex
        sel_col_index = e.ColumnIndex
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MessageBox.Show(DataGridView1.Item(sel_col_index, sel_row_index).Value.ToString)
End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.