DataGrid, dataview and row selections...............

G

Guest

Hi

I have created a dataset that selects all information from a 'Client' database table
I then created a dataview from this so that i can filter the data according to the clients surname.
This dataview is the datasource for my datagrid
I have the following code to highlight the entire row when any cell of the datagrid is clicked..

Private Sub DGrid1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DGrid1.MouseU
'code to select whole line from the datagrid when any cell is clicke
Dim pt = New Point(e.X, e.Y
Dim hti As DataGrid.HitTestInfo = DGrid1.HitTest(pt
If hti.Type = DataGrid.HitTestType.Cell The
DGrid1.CurrentCell = New DataGridCell(hti.Row, hti.Column
DGrid1.Select(hti.Row
End I
End Su

What i wanted to do is when the user highlights a row in the way shown above by clicking on any cell, i need to retrieve the value that is stored in the first column of that specific row. I then want this value to be put into a variable so that i can use it elsewhere
Is this possible?? Can someone plz tell me how i can access this value?

I am using VS.NET 2002 and am creating a windows app using VB.NE

Can anyone plz help me to try and solve this problem
 
G

Guest

private void dataGrid1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
DataGrid myGrid = (DataGrid) sender;
System.Windows.Forms.DataGrid.HitTestInfo hti;
hti = myGrid.HitTest(e.X, e.Y);
int myRow=(int)hti.Row;
}

this is ur row number now retrive the values from the grid
 
G

Guest

How do i retrieve the values from the grid?? Do i use column names

Does this work for a dataview??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top