currentgridrow.RowIndex
Regards, Raja, USA
Thanks & Regards,
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if(e.RowIndex>=0 && e.ColumnIndex>=0) MessageBox.Show(string.Format("Row Index:{0}, Column Index:{1}", e.RowIndex, e.ColumnIndex)); }
Private Sub dataGridView1_CellClick(sender As Object, e As DataGridViewCellEventArgs) If e.RowIndex >= 0 AndAlso e.ColumnIndex >= 0 Then MessageBox.Show(String.Format("Row Index:{0}, Column Index:{1}", e.RowIndex, e.ColumnIndex)) End If End Sub
Regards, Susan
string text = dataGridView1.Rows[e.RowIndex].Cells["ColumnName"].Value.ToString();
Thanks Ravi Ranjan Kumar http://raviranjankr.wordpress.com
private void dataGridView1_MouseClick(object sender, MouseEventArgs e) { int _theight = 0; string _Location = ""; if (e.Y >= _theight && e.Y <= _theight + dataGridView1.ColumnHeadersHeight) _Location= "Header"; else { _Location = ""; _theight = _theight + dataGridView1.ColumnHeadersHeight; foreach (DataGridViewRow item in dataGridView1.Rows) { if (e.Y >= _theight && e.Y <= _theight + item.Height) { _Location = "Row Index: " + item.Index; break; } else _theight = _theight + item.Height; } if(_Location== "") _Location="Outside"; } MessageBox.Show(_Location); }
Thanks&Regards LakshmiNarayana Nalluri.
Login to post response