Hi
Not sure if I understand your question, but maybe this is in the right area.
Here is some demo code that will add customer code to transaction datatable (and displayed in datagridview named DGV) based on user selection from combobox named CB (filled with names from customer datatable). If you want to try this code please start a new project and put a combobox named CB and a dtagridview named DGV onto Form1, then copy/replace Form1 code with this code.
' Form1 with ComboBox named CB
' DataGridView named DGV
Option Strict On
Option Explicit On
Public Class Form1
Dim customer As New DataTable
Dim transaction As New DataTable
' just to stop calls to CB event handler
' before data has been created
Dim started As Boolean = False
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
With customer
.Columns.Add("code", GetType(String))
.Columns.Add("name", GetType(String))
' some dummy data
.Rows.Add("AZ23BY675", "LesHay")
.Rows.Add("PQ7ZXT368", "Hossam")
.Rows.Add("WWP988GTW", "Somebody")
.Rows.Add("SK59UGG", "Else")
End With
With transaction
.Columns.Add("code", GetType(String))
End With
DGV.DataSource = transaction
With CB
.DataSource = customer
.DisplayMember = "name"
.ValueMember = "code"
End With
started = True
End Sub
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CB.SelectedIndexChanged
' add code to transaction datatable
' when user selects name from combobox
If Not started Then Exit Sub
transaction.Rows.Add(CB.SelectedValue.ToString)
End Sub
End Class