Hi,
I think you want this one. Try following demo (copy code in empty Form and start):
Public Class Form18
Public TemplateList As New List(Of Template)
Public BS_TemplateList As New BindingSource
Public WorkList As New List(Of Work)
Public BS_WorkList As New BindingSource
Private DataGridView1 As New DataGridView With {.Left = 10, .Top = 10, .Width = 400, .Height = 200}
Private DataGridView2 As New DataGridView With {.Left = 420, .Top = 10, .Width = 400, .Height = 200}
Private WithEvents Button3 As New Button With {.Text = "Add New", .Left = 500, .Top = 220}
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
TemplateList.Add(New Template With {.ID = 1, .Description = "Discription 1", .HourDefault = 1, .UnitPrice = 5})
TemplateList.Add(New Template With {.ID = 2, .Description = "Discription 2", .HourDefault = 1, .UnitPrice = 10})
TemplateList.Add(New Template With {.ID = 3, .Description = "Discription 3", .HourDefault = 1, .UnitPrice = 15})
TemplateList.Add(New Template With {.ID = 4, .Description = "Discription 4", .HourDefault = 1, .UnitPrice = 20})
WorkList.Add(New Work With {.WorkID = 1, .Item = "Work1", .TemplateID = 1, .Hour = 11, .Remarks = "Remarks 1"})
WorkList.Add(New Work With {.WorkID = 2, .Item = "Work2", .TemplateID = 3, .Hour = 33, .Remarks = "Remarks 2"})
WorkList.Add(New Work With {.WorkID = 3, .Item = "Work3", .TemplateID = 4, .Hour = 22, .Remarks = "Remarks 3"})
Me.Controls.AddRange(New Control() {DataGridView1, DataGridView2, Button3})
BS_TemplateList.DataSource = TemplateList
DataGridView1.DataSource = BS_TemplateList
BS_WorkList.DataSource = WorkList
DataGridView2.DataSource = BS_WorkList
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
For Each work In WorkList
With TemplateList.Where(Function(w)
Return w.ID = work.TemplateID
End Function).First
.Hour = work.Hour
.Remarks = work.Remarks
End With
Next
End Sub
Public Class Template
Public Property ID As Integer
Public Property Description As String
Public Property Hour As Integer?
Public Property HourDefault As Integer
Public Property UnitPrice As Integer
Public ReadOnly Property Cost As Integer
Get
If Hour > 0 Then
Return Hour.Value * UnitPrice
Else
Return HourDefault * UnitPrice
End If
End Get
End Property
Public Property Remarks As String
End Class
Public Class Work
Public Property WorkID As Integer
Public Property Item As String
Public Property TemplateID As Integer
Public Property Hour As Integer
Public Property Remarks As String
End Class
End Class
Result: