Value of a particular column of selected row in DataGrid 
Author Message
 Value of a particular column of selected row in DataGrid

I'm using VB.Net.  How can I retrieve the value of a particular column of
the selected row in DataGrid?

Also, now if I clicked on a cell of the DataGrid, only that cell is
highlighted.  But what I want is to highlight the whole row.  Please provide
some coding for reference.


Mon, 17 Jan 2005 14:08:14 GMT  
 Value of a particular column of selected row in DataGrid

To get the value of a particular cell, you can use the following syntax:
       MessageBox.Show(DataGrid1.Item(iRow, iCol))

To select the whole row, you can try the following code in the MouseUp
    Private Sub DataGrid1_MouseUp(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles DataGrid1.MouseUp
        Dim pt As System.Drawing.Point = New System.Drawing.Point(e.X, e.Y)
        Dim hti As DataGrid.HitTestInfo = DataGrid1.HitTest(pt)
        If hti.Type = DataGrid.HitTestType.Cell Then
        End If
    End Sub

Elan Zhou
This posting is provided "AS IS" with no warranties, and confers no rights.
Got .Net?

Fri, 21 Jan 2005 17:50:57 GMT  
 [ 2 post ] 

 Relevant Pages 

1. How to retrieve value of a particular column of selected row in DataGrid?

2. Column Value of a Clicked/Selected Row in a DataGrid

3. Retrieve values from column in selected rows of a TDBGrid 7.0 grid control

4. datagrid: How to find a particular row number ?

5. help, selecting and accessing particular rows

6. Selecting a particular value in a DBCombo box (VB5.0)

7. Preventing DataGrid Row/Column Resizing At Runtime

8. How do you: (get/read/retrieve/return) column values from the row of a datagrid that a user select?

9. Datagrid swap columns and rows

10. How do you retrieve the value from a column in a selected row of a datagrid?

11. Printing Rows and Columns in a Datagrid

12. Changing the number of rows and columns in a DataGrid


Powered by phpBB® Forum Software