Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Dt As New DataTable
Dim Dc As DataColumn
Dim Dr As DataRow
Dc = New DataColumn
Dc.ColumnName = "Text"
Dc.DataType = Type.GetType("System.String")
Dt.Columns.Add(Dc)
Dc = New DataColumn
Dc.ColumnName = "Value"
Dc.DataType = Type.GetType("System.String")
Dt.Columns.Add(Dc)
Dr = Dt.NewRow
Dr("Text") = "พระอินนทร์"
Dr("Value") = "C:\Users\Desktop\Pic\ลายไทย\pranaraitv2.jpg"
Dt.Rows.Add(Dr)
Dr = Dt.NewRow
Dr("Text") = "พระราม"
Dr("Value") = "C:\Users\Desktop\Pic\ลายไทย\praramte2.jpg"
Dt.Rows.Add(Dr)
With ComboBox1
.DataSource = Dt
.DisplayMember = "Text"
.ValueMember = "Value"
End With
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
On Error Resume Next
PictureBox1.Image = Image.FromFile(ComboBox1.SelectedValue.ToString)
End Sub