Public Class Carwashform

    Const EXTERIOR1_String As String = "Hand Wash"
    Const EXTERIOR2_String As String = "Hand Wax"
    Const EXTERIOR3_String As String = "Check Engine Fluids"
    Const EXTERIOR4_String As String = "Detail Engine Compartment"
    Const EXTERIOR5_String As String = "Detail Under Carriage"

    Const Interior1_String As String = "Fragrance"
    Const Interior2_String As String = "Shampoo Carpets"
    Const Interior3_String As String = "Interior Protecttion Coat"
    Const Interior4_String As String = "Shampoo Upholstery"
    Const Interior5_String As String = "Scotchgard"

    Private Sub detaillistbox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DetailPackageList.SelectedIndexChanged

        Exteriorlist.Items.Clear()
        Interiorlist.Items.Clear()

        If DetailPackageList.SelectedIndex = 0 Then
            Exteriorlist.Items.Add(EXTERIOR1_String)
            Interiorlist.Items.Add(Interior1_String)


            'Display the options in a Deluxe Detail Package
        ElseIf DetailPackageList.SelectedIndex = 1 Then
            Exteriorlist.Items.Add(EXTERIOR1_String)
            Exteriorlist.Items.Add(EXTERIOR2_String)
            Interiorlist.Items.Add(Interior1_String)
            Interiorlist.Items.Add(Interior2_String)
        End If
        'Display the options in a Executive Detail Package
        If DetailPackageList.SelectedIndex = 2 Then
            Exteriorlist.Items.Add(EXTERIOR1_String)
            Exteriorlist.Items.Add(EXTERIOR2_String)
            Exteriorlist.Items.Add(EXTERIOR3_String)
            Interiorlist.Items.Add(Interior1_String)
            Interiorlist.Items.Add(Interior2_String)
            Interiorlist.Items.Add(Interior3_String)
            'Display the options in a Luxury Detail Package
        ElseIf DetailPackageList.SelectedIndex = 3 Then
            Exteriorlist.Items.Add(EXTERIOR1_String)
            Exteriorlist.Items.Add(EXTERIOR2_String)
            Exteriorlist.Items.Add(EXTERIOR3_String)
            Exteriorlist.Items.Add(EXTERIOR4_String)
            Exteriorlist.Items.Add(EXTERIOR5_String)
            Interiorlist.Items.Add(Interior1_String)
            Interiorlist.Items.Add(Interior2_String)
            Interiorlist.Items.Add(Interior4_String)
            Interiorlist.Items.Add(Interior5_String)
        End If



    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim strDetail1, strDetail2, strDetail3, strDetail4 As String

        strDetail1 = "Standard"
        strDetail2 = "Deluxe"
        strDetail3 = "Executive"
        strDetail4 = "Luxury"

        Me.DetailPackageList.Items.Add(strDetail1)

        Me.DetailPackageList.Items.Add(strDetail2)

        Me.DetailPackageList.Items.Add(strDetail3)

        Me.DetailPackageList.Items.Add(strDetail4)
    End Sub

    Private Sub exitbutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitbutton.Click
        Me.Close()
    End Sub

    Private Sub clearbutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles clearbutton.Click
        Exteriorlist.Items.Clear()
        Interiorlist.Items.Clear()

    End Sub


    Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
        'Set up the printer output
        Dim PrintFont As New Font("Arial", 12)
        Dim LineHeightSingle As Single = PrintFont.GetHeight + 2
        Dim VerticalPrintLocationSingle As Single = e.MarginBounds.Left
        Dim HorizontalPrintLocationSingle As Single = e.MarginBounds.Top
        Dim PrintLineString As String
        Using HeadingFont As New Font("Arial", 14)
            'Print Report Headings
            PrintLineString = "Car Wash at VB auto Center"
            e.Graphics.DrawString(PrintLineString, HeadingFont, Brushes.Black, VerticalPrintLocationSingle, HorizontalPrintLocationSingle)
            HorizontalPrintLocationSingle += LineHeightSingle
        End Using
        'Print the programmer's name
        PrintLineString = "Programmer: Me"
        e.Graphics.DrawString(PrintLineString, PrintFont, Brushes.Black, VerticalPrintLocationSingle, HorizontalPrintLocationSingle)
        HorizontalPrintLocationSingle += LineHeightSingle * 2
        'Print the exterior data
        PrintLineString = "Exterior: "
        e.Graphics.DrawString(PrintLineString, PrintFont, Brushes.Black, VerticalPrintLocationSingle, HorizontalPrintLocationSingle)
        HorizontalPrintLocationSingle += LineHeightSingle
        For ListIndexInteger As Integer = 0 To Exteriorlist.Items.Count - 1
            PrintLineString = Exteriorlist.Items(ListIndexInteger).ToString
            e.Graphics.DrawString(PrintLineString, PrintFont, Brushes.Black, VerticalPrintLocationSingle, HorizontalPrintLocationSingle)
            HorizontalPrintLocationSingle += LineHeightSingle
        Next ListIndexInteger
        HorizontalPrintLocationSingle += LineHeightSingle 'Blank line

        'Print the interior data
        PrintLineString = "Interior: "
        e.Graphics.DrawString(PrintLineString, PrintFont, Brushes.Black, VerticalPrintLocationSingle, HorizontalPrintLocationSingle)
        HorizontalPrintLocationSingle += LineHeightSingle
        For ListIndexInteger2 As Integer = 0 To Interiorlist.Items.Count - 1
            PrintLineString = Exteriorlist.Items(ListIndexInteger2).ToString
            e.Graphics.DrawString(PrintLineString, PrintFont, Brushes.Black, VerticalPrintLocationSingle, HorizontalPrintLocationSingle)
            HorizontalPrintLocationSingle += LineHeightSingle
        Next ListIndexInteger2

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try
            PrintPreviewDialog1.Document = PrintDocument1
        Catch es As Exception
            MessageBox.Show(es.Message)
        End Try
        PrintPreviewDialog1.ShowDialog()


    End Sub
End Class

We want to create an application for the car wash at VB Auto Center.
The form will contain three list box controls that do not permit the user to type in items at run time. The
first list will contain the names of the packages available for detailing a vehicle: Standard, Deluxe,
Executive, or Luxury.
The contents of the other two lists will vary depending upon the package selected. Display one list for the
interior work and one list for the exterior work. Store the descriptions of the items in string constants.
You must clear the lists for the interior and exterior for each order and add new items to the lists each
time the user makes a selection from the package list.
Use a drop-down list to allow the user to select the fragrance. The choices are Hawaiian Mist, Baby
Powder, Pine, Country Floral, Pina Colada, and Vanilla.
Include menu items for Print Order, Clear, and Exit with appropriate access keys. The print option should
send its output to the Print Preview window. Include your name and a heading at the top of the report.
The Order printout will contain the package name (Standard, Deluxe, Executive, or Luxury), the interior
and exterior items included, and the fragrance selected. Use a For/Next loop when printing the interior
and exterior lists.

Im not sure what to do with the dropdown menu if the user selects fragrance...?

It is almost like they want a dropdown list inside a listbox...

No one?

Im not sure what to do with the dropdown menu if the user selects fragrance...?

I don't see that you need a drop down list inside the listbox. It would just be an option that would be available (enabled) as long as the selected package included a scent. The default could be no scent (especially import these days with so many people being sensitive to perfumes, etc). All that selecting a fragrance would do is cause the selected fragrance (or lack of) to be printed along with the other info on the work order.

So all is good with my code?

But still what should I do about the following question: Use a drop-down list to allow the user to select the fragrance. The choices are Hawaiian Mist, Baby
Powder, Pine, Country Floral, Pina Colada, and Vanilla.

This is confusing me so badly..

I don't know if all is good with your code. Does it work when you run it? As for the dropdown, create a dropdown list with the entries

no scent
Hawaiian Mist
Baby Powder
Pine
Country Floral
Pina Colada
Vanilla

then print whatever item was selected when the form is printed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.