Found it at the German Newsgroup:
Dim par1 As Integer = 5
Dim par2 As Integer = 6
' Verweis auf Tabelle
Dim dt As DataTable = _
CType(bs1.DataS ource, DataSet).Tables (bs1.DataMember )
' Filter aufbauen
Dim filter As String = _
String.Format(" {0} = {1} AND {2} = {3}", _
dt.PrimaryKey(0 ).ColumnName, par1, _
dt.PrimaryKey(1 ).ColumnName, par2)
' DataRow heraussuchen
Dim rows() As DataRow = dt.Select(filte r)
' auf Zeile positionieren
If rows.Length = 1 Then
Dim tempRows() As DataRow = dt.Select(bs1.F ilter, bs1.Sort)
bs1.Position = Array.IndexOf(t empRows, rows(0))
Else
Trace.WriteLine ("kein Satz gefunden")
End If
"Foef" wrote:
I have a BindingSource with an underlying table with two primary keys.
To set the position with one primary key works fine as shown in the code
snippet below:
Dim index As Integer = myBindingSource .Find("ColumnNa me", myColumnName)
If (index <-1) Then
myBindingSource .Position = index
End If
How should I set the BindingSource.P osition with two or more primary keys?
Thanks
Foef