Can someone help me with this simple multiplication. The report is to have column that shows the total value of each inventory item and display the highest one in a text box.. The total value of an inventory item is its price times quantity on hand (Price * QOH) and display it in a list box. Heres the code i have right now and the inventory.txt info. I have erased all my attempts at it in search for the correct way to do it.
A12345-stock number
10.50-stock price
1000-QOA
B12345
1.50
10000
C12345
150.00
10
A12345-stock number
10.50-stock price
1000-QOA
B12345
1.50
10000
C12345
150.00
10
VB.NET:
Public Class Form1
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim srinventory As IO.StreamReader = IO.File.OpenText("inventory.txt")
Dim stock As String
Dim quan, price As Double
Dim highestprice As Double
Dim higheststock As String
Do Until srinventory.EndOfStream
stock = srinventory.ReadLine
price = srinventory.ReadLine
quan = srinventory.ReadLine
ListBox1.Items.Add(stock & " " & price & " " & FormatCurrency(price) & quan)
If price > highestprice Then
highestprice = price
higheststock = stock
End If
Loop
TextBox1.Text = higheststock & " " & FormatCurrency(highestprice)
srinventory.Close()
End Sub