Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub DATABASE_Save()
- Dim sb As New StringBuilder
- For Each item As Alimento In Alimentos
- sb.AppendLine($"{item.Categoria}|{item.Alimento}|{item.Calorias}|{item.Proteinas}|{item.Hidratos}|{item.Lipidos}|{item.Gorduras}|{item.Quantidade}")
- Next
- System.IO.File.WriteAllText(PATH_DATABASE, sb.ToString)
- End Sub
- Private Sub DATABASE_Open()
- Dim sb As New StringBuilder
- Dim lines() As String = IO.File.ReadAllLines(PATH_DATABASE)
- For Each line In lines
- Alimentos.Add(New Alimento("1", "2", "3", "4", "5", "6", "7", "8"))
- 'Basically, first it checks for how many lines the text document has and then adds each Alimento accordingly to how many lines there are. Where I'm stuck: numbers (1-8) should contain each item inside each line. Hope that makes sense?
- Next
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement