|
-
January 8th, 2008, 01:04 AM
#1
show data in datagridview
hi,
i have a datagridview which displays data from a MySQL table (using ODBC connection).
what i want to do is, when i click one of cells inside the datagridview, a message box will pop-up,displaying all the other data from the selected row. how do i do it?
thanks in advance
-
January 8th, 2008, 07:09 PM
#2
Re: show data in datagridview
Many ways to do this I suppose.
Code:
private void click_cellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
{
string www = "";
DataGridView dgv = (DataGridView)sender;
int w = dgv.CurrentCell.RowIndex;
for(int i=0; i < dgv.Rows[w].Cells.Count; i++)
{
www += (string)dgv.Rows[w].Cells[i].Value + " ";
}
MessageBox.Show(www);
}
BTW... The datagridview event you want to capture is "CellMouseUp"
-
January 8th, 2008, 11:39 PM
#3
Re: show data in datagridview
thanks... actually i've already got a way to do it... anyway thanks for the alternative way
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|