The Pizza Project

If you wish, you can read the list of toppings in from a file instead of adding them to the collection for the checked list box:

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Dim s As String
        FileOpen(1, "C:\zebra0\resource\toppings.txt", OpenMode.Input) 'open the file for input
        While Not EOF(1) 'EOF=End of file, this loops to read all lines in the file
      
      S = LineInput(1) 'read from file 1
            Me.CheckBoxToppings.Items.Add(S) 'add the item read to the combo box
        End While
        FileClose(1) 'close file 1
    End Sub

To Do:

You learn as you experiment and refine the project. Don't be afraid to add additional refinements to this project.


INDEX, The Pizza Project, Designing the form, Write the code to calculate the price, Read the list of toppings from a file
Next lesson: Files in Visual Basic

Copyright © Zebra0.com
All rights reserved worldwide.

 
 

Read the list of toppings from a file