I need help to create a project for vb auto center from Programming in Visual Basic 2008 Chapter 11 pg 468.

Write a project to store vehicle information including model, manufacturer, year, and VIN number.
Create a second project that load the data from the file into memory and loads a drop-down combo box with the VIN numbers. When a number is selected from the combo box display the information in respective labels.

You will need to create a class that stores all the required information, being careful to choose the variable type to match the nature of the variable.

Then you'll need an input form that accepts user input and store the information for each vehicle. The input form should contain a button to save the data to a file.

Once the first part is done, the second part is relatively easy, just search for the given VIN and display the information.

Thank you, but I still have difficulties with the code for second part of the project. I know i have to use reading a file method, but I don't get the right results. Can you help me with this?

Yeah, but we'd have to know what you have so far and what the results are.

I can get right the write and save file for the data, but for the stream reading file I don't know how to start the code and to open the stream writing file for the VIN number to get the other results for model, manufacturer, and year.

To create a project for VB Auto Center, you will need to follow these steps:

1. Set up the first project to store vehicle information:
a. Open Visual Basic 2008 and create a new Windows Forms Application project.
b. Add labels, textboxes, a combo box, and a button to the form to display and input vehicle information.
c. Create variables to store vehicle details like model, manufacturer, year, and VIN number.
d. Implement event handlers for button click events to save the entered data to a file.

2. In the second project, load the data from the file into memory:
a. Create a new Windows Forms Application project.
b. Add a combo box and labels to display the vehicle information retrieved from the file.
c. Implement an event handler for the form's Load event.

Here is an outline of how to implement these steps:

First project:
1. Open Visual Basic 2008.
2. Create a new project by selecting File -> New Project.
3. Choose Windows Forms Application and provide a name for your project (e.g., "AutoCenter").
4. Design the form to include labels, textboxes, a combo box, and a button.
- Add labels for model, manufacturer, year, and VIN number.
- Add textboxes for user input.
- Add a combo box to display VIN numbers.
- Add a button to save the entered data to a file.
5. Create variables to store the vehicle details at the top of the form's code:
```
Private model As String
Private manufacturer As String
Private year As Integer
Private vinNumber As String
```
6. Implement the button's click event handler to save the entered data to a file:
```
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
model = txtModel.Text
manufacturer = txtManufacturer.Text
year = Integer.Parse(txtYear.Text)
vinNumber = txtVIN.Text

'Open a file for writing and save the data
Dim outputFile As StreamWriter = New StreamWriter("vehicle_data.txt", True)
outputFile.WriteLine($"{model},{manufacturer},{year},{vinNumber}")
outputFile.Close()

'Clear the textboxes after saving
txtModel.Text = ""
txtManufacturer.Text = ""
txtYear.Text = ""
txtVIN.Text = ""
End Sub
```
7. Run the project to test the input and saving functionality.

Second project:
1. Open Visual Basic 2008.
2. Create a new project by selecting File -> New Project.
3. Choose Windows Forms Application and provide a name for your project (e.g., "AutoCenterViewer").
4. Design the form to include a combo box and labels.
- Add a combo box for selecting VIN numbers.
- Add labels to display the vehicle details (model, manufacturer, year, etc.).
5. Implement the form's Load event handler to load the data from the file and populate the combo box:
```
Private Sub AutoCenterViewer_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim inputFile As StreamReader = New StreamReader("vehicle_data.txt")
Dim line As String

'Read the file line by line and populate the combo box
While inputFile.Peek() >= 0
line = inputFile.ReadLine()
Dim data As String() = line.Split(","c)
cboVIN.Items.Add(data(3)) 'Assuming the VIN number is stored at index 3
End While

inputFile.Close()
End Sub
```
6. Implement the combo box's SelectedIndexChanged event handler to display the corresponding vehicle information:
```
Private Sub cboVIN_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboVIN.SelectedIndexChanged
Dim selectedIndex As Integer = cboVIN.SelectedIndex
Dim inputFile As StreamReader = New StreamReader("vehicle_data.txt")
Dim line As String

'Read the file until reaching the selected line and display the information in labels
For i As Integer = 0 To selectedIndex
line = inputFile.ReadLine()
If i = selectedIndex Then
Dim data As String() = line.Split(","c)
lblModel.Text = data(0)
lblManufacturer.Text = data(1)
lblYear.Text = data(2)
lblVIN.Text = data(3)
End If
Next

inputFile.Close()
End Sub
```
7. Run the project to test the combo box selection and display functionality.

That's it! You have now created two projects: one to store vehicle information and another to load that information and display it based on the selected VIN number.