Home All Groups Group Topic Archive Search About
Author
9 Feb 2006 12:11 AM
Brian Shafer
Hello,
I am a newbi to this fourm and to vb.net.... moving from vb classic.  
Testing with a database connection,  got my data in the dataview control. 
But now, I want to be able to double click a row and return a value from a
cell.  Something like what use to be the textmatrix in MSHFlex grid. 
How would I do that?
Brian

Author
9 Feb 2006 1:19 AM
Ken Tucker [MVP]
Hi,

        Handle the rowheadermousedoubleclick event to get the value of a
column when the row header is double clicked and the cellmousedoubleclick
event to get the value when a cell is double clicked.

    Private Sub DataGridView1_RowHeaderMouseDoubleClick(ByVal sender As
Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs)
Handles DataGridView1.RowHeaderMouseDoubleClick
        MessageBox.Show(DataGridView1.Item(0, e.RowIndex).Value.ToString)
    End Sub


    Private Sub DataGridView1_CellMouseDoubleClick(ByVal sender As Object,
ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles
DataGridView1.CellMouseDoubleClick
        If e.ColumnIndex < 0 Or e.RowIndex < 0 Then Return
        MessageBox.Show(DataGridView1.Item(e.ColumnIndex,
e.RowIndex).Value.ToString)
    End Sub


Ken
----------------
Show quoteHide quote
"Brian Shafer" <BrianSha***@discussions.microsoft.com> wrote in message
news:D586544D-E7AE-46DC-AE66-4EB60D347001@microsoft.com...
> Hello,
> I am a newbi to this fourm and to vb.net.... moving from vb classic.
> Testing with a database connection,  got my data in the dataview control.
> But now, I want to be able to double click a row and return a value from a
> cell.  Something like what use to be the textmatrix in MSHFlex grid.
> How would I do that?
> Brian