Hi all,
I would like to display all my data from my datatable to my listbox.
The code is working but not as I planned.
My datatable looks like:
(Id is not unique)
Id | Klant naam | Klant voornaam | Product Naam | Aantal stuks
1 - Raemen - Ward - GTX460 - 5
1 - Raemen - Ward - GTX670 - 5
2 - Put - Kenneth - CM II Advanced - 1
I would like to display it like this:
![Name: list.png
Views: 28
Size: 5.9 KB]()
Is this possible?
Thanks in advance!
I would like to display all my data from my datatable to my listbox.
The code is working but not as I planned.
Code:
Private Sub Bestellingen_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For i = 0 To EasybyteDataSet.Bestellingen.Rows.Count - 1
If i = EasybyteDataSet.Klanten.Rows(i)("Id") Then
intBestelnr = EasybyteDataSet.Bestellingen.Rows(i)("Id")
End If
strKlantnaam = EasybyteDataSet.Bestellingen.Rows(intBestelnr)("Klant naam")
strKlantVN = EasybyteDataSet.Bestellingen.Rows(intBestelnr)("Klant voornaam")
strProductNaam = EasybyteDataSet.Bestellingen.Rows(intBestelnr)("Product naam")
For j = 0 To EasybyteDataSet.Bestellingen.Rows.Count
If strProductNaam = EasybyteDataSet.Stock.Rows(j)("Product naam") Then
sngPrijs = EasybyteDataSet.Stock.Rows(j)("Prijs")
Exit For
End If
Next
intStuks = EasybyteDataSet.Bestellingen.Rows(intBestelnr)("Aantal stuks")
sngTotaal = intStuks * sngPrijs
strItem = Omzetting(strKlantnaam, strKlantVN, strProductNaam, sngPrijs, intStuks, sngTotaal)
lstOrders.Items.Add(strItem)
Next
End Sub
Private Function Omzetting(ByVal strN As String, ByVal strVN As String, ByVal strPN As String, ByVal sngP As Single, ByVal intS As Integer, ByVal sngT As Single) As String
Dim strItem As String
strItem = strN & Space(30 - strN.Length) & strVN & Space(35 - strVN.Length) & strPN & Space(45 - strPN.Length) & "€" & sngP & Space(25 - sngP.ToString.Length) & intS & Space(30 - intS.ToString.Length) & "€" & sngT
Return (strItem)
End Function
(Id is not unique)
Id | Klant naam | Klant voornaam | Product Naam | Aantal stuks
1 - Raemen - Ward - GTX460 - 5
1 - Raemen - Ward - GTX670 - 5
2 - Put - Kenneth - CM II Advanced - 1
I would like to display it like this:
Is this possible?
Thanks in advance!