Hi, I have made a code where I write a recipe to a file and then I can read from the file and it is output in a listbox. I need to allow the user to change the amount of people served and then the quantities change to suit the serving number. The serving number is input and the rest of the code works apart from the changing the quantities bit.
The code that I am using is below. I have no idea if i'm doing it right though.
Private Sub btnOKServed_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOKServed.Click
lstExistingRecipe.Items.Clear()
Dim FileReader As New IO.StreamReader("E:\" & lstRecipeChoose.Text & ".txt")
Dim charcounter As Double
Do While FileReader.Peek <> -1
StrEntry = FileReader.ReadLine().ToString
If StrEntry.StartsWith(Ingredients & "Quantity and units: ") Then
Quantity = StrEntry.Substring(charcounter + 20, 3)
NewIngredientsAndUnits = StrEntry.Substring(charcounter + 24)
Quantity = lstExistingRecipe.Text / PeopleServed * NewPeopleServed
NewRecipe = Ingredients & "Quantity and units: " & Quantity & NewIngredientsAndUnits
lstExistingRecipe.Items.Add(NewRecipe)
End If
Loop
End Sub
Thanks in advance!
**