Fill DataGrid with value from variabels
Hi everyone,
I'm new with VB 2005 and busy (trying) to make a program that calculates.
I'm holding up at the moment by filling a DataGrid with value from variabels.
My code so far is:
Code:
If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then
Dim aArtikel, bArtikel, cArtikel, dArtikel As String
Dim r, i As Integer
Dim Optel, Optel2 As String
Dim tekst1, tekst2, tekst3, tekst4 As String
Dim toevoeg
aArtikel = Me.txtBarCode.Text
Me.conn.Open()
ds.Clear()
Me.da.Fill(ds.Tables("Artikellijst"))
r = ds.Tables("Artikellijst").Rows.Count()
For i = 0 To r - 1
bArtikel = ds.Tables("Artikellijst").Rows(i).Item("EANcode")
cArtikel = ds.Tables("Artikellijst").Rows(i).Item("Artikel")
dArtikel = ds.Tables("Artikellijst").Rows(i).Item("Verkoopprijs")
If aArtikel = bArtikel Then
On Error Resume Next
tekst1 = Me.txtAantal.Text
tekst1 = FormatNumber(tekst1, 0)
tekst2 = cArtikel
tekst3 = dArtikel
tekst3 = FormatNumber(tekst3, 2)
tekst4 = tekst1 * dArtikel
tekst4 = FormatNumber(tekst4, 2)
toevoeg = tekst1 & vbTab & tekst2 & vbTab & tekst3 & vbTab & tekst4
DataGridView1.Rows.Add(toevoeg)
Exit For
End If
Next
Me.conn.Close()
End If
The exact problem (chalance) is to get the value from tekst1 in Column1 from the DataGrid and the value from tekst2 in Column2 etc.
If have search the internet but I could not found a matching solution.
Can somebody help me please.
Thanks,
E.