Thank you for the example. It worked great (although I
had to modify it a little bit cause using Sql Server). I
am just starting out with VB.net (stepping up from com
VB). Anyway, I haven't worked with dataviews yet. So
this example was nice because that is next. But I did
come up with a kludgy sort of solution for the datagrid.
I hope maybe you could explain about var.GetType. GetType
is confusing me. Here is the solution I came up with:
Dim dRow As DataRow, ddRow() As DataRow
Dim t1 As DataTable, , str1 As Object
Dim i As Integer, j As Integer, k As Integer
t1 = ds3.Tables("Contacts")
j = 27 '--->hardoce a value that I know is there
dRow = t1.Rows.Find(27)
If Not dRow Is Nothing Then
ddRow = t1.Select()
For i = 0 To ddRow.GetUpperBound(0)
str1 = ddRow(i)(0)
k = CType(str1, Integer)
If k = j Then
cma.Position = i
drg1.Select(drg1.CurrentRowIndex)
Exit For
End If
Next
End If
So if my dataRow (dRow) is not Nothing then I set up a
dataRow array ddRow() and loop through that. The real
kludgy part is that when ddRow(i)(0) = 27 I don't know how
to compare it to j (an Integer). So I set up an object
(str1) to this value, and the only way I could come up
with to extract the value was to set up another Integer, k
as above. How else could I compare the value stored in
ddRow(i)(0) to j?
Thanks again for your reply,
Rich
-----Original Message-----
Hi,
The dataview has a find method that returns the
row number of asorted column. Use the currency manager to go to that
row. If you need touse a datatable you need to find the row number
yourself. Here is a link toan example that uses a dataview.
http://www.onteorasoftware.com/downl...taviewfind.zip
Ken
------------------
"Rich" <an*******@discussions.microsoft.com> wrote in
messagenews:7a****************************@phx.gbl... Hello,
If my datagrid is based on a dataTable (t1) and the
currency manager is also bound to t1 and I do a find on
a key
dim dRow As DataRow, t1 As DataTable
...
dRow = t1.Rows.find(somekey)
If Not dRow Is Nothing
how can I move the currency manager to this row?
Thanks,
Rich
.