Hello people,


Below it is a picture of two different data tables presented in two different datagridviews.

Name:  datagridvbiew.jpg
Views: 281
Size:  24.5 KB


Table1= contains 20 columns
table2= contains 1 column

both tables contains a column called "Context Matches"(just different column index numbers)

Now I need to loop every item in table1 and column "Order number",
if any row item in "table2" column "Context Matches" contains the item (from column "Order number"(table1))
then copy founded item from "table2" to "table1" column "Context Matches".


I have created a code with help from people,
If an item exists twice in the column, regardless of row, the first instance must control all identical instances throughout. When an identical instance is identified, the content from the “target language” column in the first instance must be copied to the “target language” columns in all the other instances.

Code:
Dim ThisOrder As Integer = 0
Dim LastOrder As Integer = 0
Dim ThisLanguage As String = ""

For i As Integer = 0 To HashDatatable1.Rows.Count - 1
ThisOrder = HashDatatable1.Rows(i).Item("OrderNumber") 'get Order Number from current row

If i = 0 Then ThisLanguage = HashDatatable1.Rows(i).Item("TargetLanguage") 'Get Target Language if this is the first row

If i > 0 Then 'only run this code for rows after the first
If ThisOrder = LastOrder Then 'check if ThisOrder is the same as LastOrder
HashDatatable1.Rows(i).Item("TargetLanguage") = ThisLanguage 'ThisOrder and LastOrder match, so copy ThisLanguage to current row's Target Language
Else
ThisLanguage = HashDatatable1.Rows(i).Item("TargetLanguage") 'ThisOrder and LastOrder do not match (i.e., this is a new order number), so get the Target Language from the current row
EndIf
EndIf
LastOrder = ThisOrder 'set LastOrder equal to ThisOrder
Next
I need to modify it though to fit these requirements..

Could someone help me?

Thank you in advance.