I am currently doing a computing project at school, and am having trouble with some parts of it.
My task is to create a program that will store a recipe name, number of people it will serve and the list of ingredients with their quantities and units.
It also asks that the program should output the recipe name and a new number of people with revised quantities with units for any number of people that the user chooses.
So far for my code I have:
Imports System.IO
Public Class Form1
Private Sub ButtonOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonOpen.Click
Dim FileReader As StreamReader
Dim results As DialogResult
results = OpenFileDialog1.ShowDialog
If results = DialogResult.OK Then
FileReader = New StreamReader(OpenFileDialog1.FileName)
IandQ.Text = FileReader.ReadToEnd()
FileReader.Close()
End If
End Sub
Private Sub ButtonSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSave.Click
Dim FileWriter As StreamWriter
Dim results As DialogResult
results = SaveFileDialog1.ShowDialog
If results = DialogResult.OK Then
FileWriter = New StreamWriter(SaveFileDialog1.FileName, False)
FileWriter.Write(IandQ.Text)
FileWriter.Write(RecipeNameSave.Text)
FileWriter.Write(Serves.Text)
FileWriter.Close()
End If
End Sub
Private Sub AmendRecipeButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AmendRecipeButton.Click
End Sub
End Class
This code allows me to save and retrieve files but I cannot separate the recipe name or the number of people into separate text boxes from the ingredients.
I also have no clue as to how I can amend the ingredient quantities after a new number of people is chosen.
Any helpful suggestions are appreciated.
My task is to create a program that will store a recipe name, number of people it will serve and the list of ingredients with their quantities and units.
It also asks that the program should output the recipe name and a new number of people with revised quantities with units for any number of people that the user chooses.
So far for my code I have:
Imports System.IO
Public Class Form1
Private Sub ButtonOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonOpen.Click
Dim FileReader As StreamReader
Dim results As DialogResult
results = OpenFileDialog1.ShowDialog
If results = DialogResult.OK Then
FileReader = New StreamReader(OpenFileDialog1.FileName)
IandQ.Text = FileReader.ReadToEnd()
FileReader.Close()
End If
End Sub
Private Sub ButtonSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSave.Click
Dim FileWriter As StreamWriter
Dim results As DialogResult
results = SaveFileDialog1.ShowDialog
If results = DialogResult.OK Then
FileWriter = New StreamWriter(SaveFileDialog1.FileName, False)
FileWriter.Write(IandQ.Text)
FileWriter.Write(RecipeNameSave.Text)
FileWriter.Write(Serves.Text)
FileWriter.Close()
End If
End Sub
Private Sub AmendRecipeButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AmendRecipeButton.Click
End Sub
End Class
This code allows me to save and retrieve files but I cannot separate the recipe name or the number of people into separate text boxes from the ingredients.
I also have no clue as to how I can amend the ingredient quantities after a new number of people is chosen.
Any helpful suggestions are appreciated.