Public Class Insert
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'เพิ่มไฟล์
Dim dialogOpenFiles As New OpenFileDialog()
dialogOpenFiles.Multiselect = True
dialogOpenFiles.Filter = "All Files (*.*)|*.*"
If dialogOpenFiles.ShowDialog Then
Dim i As String
For Each i In dialogOpenFiles.FileNames
Dim s() As String = i.Split("\")
For j As Integer = 0 To UBound(s)
If j = 8 Then
'Me.ListBox1.Items.Add(s(8))
ElseIf j = 7 Then
'Me.ListBox2.Items.Add(s(7))
ElseIf j = 6 Then
'Me.ListBox3.Items.Add(s(6))
ElseIf j = 5 Then
'Me.ListBox4.Items.Add(s(5))
End If
Next j
Me.DataGridView2.Rows.Add(s(5), s(6), s(7), s(8), i)
Next i
End If
End Sub
Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'บันทึก
End Sub
Private Sub Insert_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'TestDataDataSet.Model' table. You can move, or remove it, as needed.
Me.ModelTableAdapter.Fill(Me.TestDataDataSet.Model)
End Sub
End Class
ขอบคุณครับ ผมทำได้แล้วอันนั้น แต่ที่นี้ มันดึงข้อมูลที่ซ้ำกันมาเพียงแค่ Record เดียว ใส่ใน combobox
ผมรู้คำสั่ง DISTINCT แต่ไม่รู้จะเอาไปใส่ตรงไหน
dts = TD2.ReadData("select * from Model where Data = '" & cbData.SelectedValue.ToString & "' and Series = '" & cbSeries.SelectedValue.ToString & "'ORDER BY ModelSerial ASC")