Hi,
Attached is a small sample that finds the closest match in a dataview.
The following is the whole code of that sample.
Imports C1.Data
Imports C1.Data.SchemaObjects
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim searchDate As DateTime = DateTimePicker1.Value.Date
Dim index As Int32
Dim field As DataField = C1DataView1.DataTable.Fields("OrderDate")
For index = 0 To C1DataView1.Count - 1
Dim test As Object = C1DataView1(index)(field)
If TypeOf test Is DateTime AndAlso test >= searchDate Then
C1DataView1.Position = index
Exit Sub
End If
Next
End Sub
End Class
Hope this will help.
Regards,
-Andrey