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