Hi,
Use the defaultview for the datatable. Here is an example.
Dim ds As New DataSet
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim strConn As String
Dim strSQL As String
Dim da As OleDbDataAdapter
Dim conn As OleDbConnection
strConn = "Provider = Microsoft.Jet.OLEDB.4.0;"
strConn &= "Data Source = Northwind.mdb;"
conn = New OleDbConnection(strConn)
da = New OleDbDataAdapter("Select * From Categories", conn)
da.Fill(ds, "Categories")
DataGrid1.DataSource = ds.Tables("Categories")
End Sub
Private Sub Form1_DoubleClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.DoubleClick
Dim cm As CurrencyManager = CType(Me.BindingContext(DataGrid1.DataSource),
CurrencyManager)
Dim drv As DataRowView
drv = ds.Tables("Categories").DefaultView.Item(cm.Positi on)
MessageBox.Show(drv.Item("CategoryName").ToString)
End Sub
Ken
---------------------------
"Brian Mitchell" <Ma********@hotmail.com> wrote in message
news:Oq**************@TK2MSFTNGP12.phx.gbl...
I'm sure this is a very dumb question but when a user clicks on a row in
my
data table (which has been sorted) how do I return the correct row index
for
my underlying data table? The CurrentRowIndex property gives me the
selected
row of the data grid which no longer matches the data table when the
columns
have been resorted.
Thanks!!!