Hey! In this case, you can create a new column in your DataTable which combines the two fields and then use the DataView to find the row based on the new combined column value. Here's how you can achieve that:
- Add a new column to your DataTable, which will store the combined values of the two fields you want to search on.
- Iterate through the rows in the DataTable and update the new column with the combined values.
- Set the Sort property on the DataView to use the new column.
- Use the DataView's Find method to locate the row based on the combined value.
' 1. Add a new column for the combined values
LocalisationTable.Columns.Add("CombinedField", GetType(String))
' 2. Iterate through the rows and update the new column with the combined values
For Each row As DataRow In LocalisationTable.Rows
row("CombinedField") = row("LocalID").ToString() & "_" & row("ItemID").ToString()
Next
' 3. Set the Sort property on the DataView
Dim dataView As DataView = LocalisationTable.DefaultView
dataView.Sort = "CombinedField"
' 4. Use the DataView's Find method to locate the row based on the combined value
Dim value1 As String = "LocalID"
Dim value2 As String = "ItemID"
Dim combinedValue As String = value1 & "_" & value2
Dim rowIndex As Integer = dataView.Find(combinedValue)
If rowIndex <> -1 Then
Dim foundRow As DataRowView = dataView(rowIndex)
' Perform your desired action with the found row
Else
' The combined value was not found in the DataView
End If
This code will create a new column "CombinedField" in your LocalisationTable, fill it with combined values of "LocalID" and "ItemID" separated by an underscore (_), and then use the DataView's Find method to locate the row based on the combined value. Is that what you're looking for more or less?