Results 1 to 6 of 6
  1. #1
    Registered lil layzie's Avatar
    Join Date
    Aug 2004

    Visual Basic Help

    This semester I'm taking an Intro To Visual Basic course and we have to use Microsoft Visual Studio 2005 to do all of our work.

    I'm currently working on a project and I've done most of the coding but I'm kinda stuck at some parts. I was wondering if any one would like to help me. I would ask my professor but it's the weekend and I don't meet up with that class until Tuesday and he never responds to any emails.

    Let me post my GUI and part of the code from my project.



    -deleted because it was making thread too long
    Okay, I hope I can explain this as clearly as I can. I'm trying to code my Order Button to make it generate a message box confirming my order and listing the cpu type with the price and listing any optional hardware if the user decides to check them. Something like this :



    I'm having trouble with the first part of my code. Its suppose to check and make sure that the user has entered all his information and checks which cpu type and payment type. If the user didn't do any of that, it will display an error message telling the user to display all the required fields. (By calling the private subs which I have not posted.) I was wondering how do I make the confirmation box not pop up when it asks the user to fill out all the require fields. (the red part of the code is where I'm having trouble placing it)

    And also the second part of my code is the private function of the confirmation message box. I was wondering how do i enter a new line of message in the box after it lists the cpu type. Like the part where it says "with the following options"

    I hope I explained everything clearly. all this coding stuff is making my brain hurt.
    Last edited by lil layzie; 10-18-08 at 08:49 AM.
    A64 3400+ 1MB CH/CG | DFI Lanparty UT nF3 250GB | 1Gb (2x512MB) PC3500 OCZ EB
    EVGA GeForce 7800GS 256MB AGP | Creative SB Audigy2 ZS Platinum
    WD 74Gb Raptor | Maxtor 120Gb DiamondMax 9 | Sony CRX100E CD-RW
    OCZ Powerstream 520w PSU | Chieftec Black Dragon
    5x80m ThermalTake Thunderblades | 1x92m Zalman Quiet Fan
    Samsung SyncMaster 171v | Logitech Z-680 | Sennheiser PC 150
    Logitech Internet Navigator Keyboard & Blue MX510 Mouse

    :beer:

  2. #2
    After "Call EmptyWarning()" and "Call CCWarning()" put "Exit Sub"

  3. #3
    Registered lil layzie's Avatar
    Join Date
    Aug 2004
    Oh! Wow that was simple. Thanks! It worked.
    I'm new to VB so yea, kinda hard for me to understand sometimes.

    edit-
    now im stuck at another part.



    How do I get the total from my form to my message box?

    The code for my total is:
    Code:
    Private Function CalculateTotal() As Decimal
    
            ' declare varibles
            Const video As Decimal = 50D
            Const harddrive As Decimal = 70D
            Const memory As Decimal = 49D
            Const sound As Decimal = 15D
            Const modem As Decimal = 9.99D
            Dim total As Decimal
            Dim isConverted As Boolean
    
            isConverted = Decimal.TryParse(totalLabel.Text, total)
    
            ' determines which cpu option is selected
            If advanceRadioButton.Checked Then
                total = 280D
            ElseIf intermediateRadioButton.Checked Then
                total = 160D
            ElseIf basicRadioButton.Checked Then
                total = 99.5D
            Else
            End If
    
    
            ' determines which check boxes (if any) are selected
            If videoCheckBox.Checked Then
                total = total + video
            End If
            If harddriveCheckBox.Checked Then
                total = total + harddrive
            End If
            If memoryCheckBox.Checked Then
                total = total + memory
            End If
            If soundCheckBox.Checked Then
                total = total + sound
            End If
            If modemCheckBox.Checked Then
                total = total + modem
            End If
    
            ' calculate the total with 6% sales tax
            total = total * 0.06D + total
    
            ' displays the total
            totalLabel.Text = total.ToString("C2")
    
        End Function
    And the code for my message box is:
    Code:
    Private Function getOrderForm() As String
    
            Dim OrderForm As String = "You have placed an order for" & vbNewLine
    
            If advanceRadioButton.Checked = True Then
                OrderForm = OrderForm & "Advance CPU ($280.00)" & vbNewLine
            ElseIf intermediateRadioButton.Checked Then
                OrderForm = OrderForm & "Intermediate CPU ($160.00)" & vbNewLine
            Else : basicRadioButton.Checked = True
                OrderForm = OrderForm & "Basic CPU ($99.50)" & vbNewLine
            End If
    
            If videoCheckBox.Checked Or _
            harddriveCheckBox.Checked Or _
            memoryCheckBox.Checked Or _
            soundCheckBox.Checked Or _
            modemCheckBox.Checked Then
                OrderForm = OrderForm & "with the following options:" & vbNewLine
            Else
            End If
    
            If videoCheckBox.Checked Then
                OrderForm = OrderForm & "   Video Card" & vbNewLine
            End If
    
            If harddriveCheckBox.Checked Then
                OrderForm = OrderForm & "   Hard Drive" & vbNewLine
            End If
    
            If memoryCheckBox.Checked Then
                OrderForm = OrderForm & "   Memory" & vbNewLine
            End If
    
            If soundCheckBox.Checked Then
                OrderForm = OrderForm & "   Sound Card" & vbNewLine
            End If
    
            If modemCheckBox.Checked Then
                OrderForm = OrderForm & "   Modem" & vbNewLine
            End If
    
            OrderForm = OrderForm & "Total price: "
    
            Return OrderForm
        End Function
    Last edited by lil layzie; 10-18-08 at 08:50 AM.
    A64 3400+ 1MB CH/CG | DFI Lanparty UT nF3 250GB | 1Gb (2x512MB) PC3500 OCZ EB
    EVGA GeForce 7800GS 256MB AGP | Creative SB Audigy2 ZS Platinum
    WD 74Gb Raptor | Maxtor 120Gb DiamondMax 9 | Sony CRX100E CD-RW
    OCZ Powerstream 520w PSU | Chieftec Black Dragon
    5x80m ThermalTake Thunderblades | 1x92m Zalman Quiet Fan
    Samsung SyncMaster 171v | Logitech Z-680 | Sennheiser PC 150
    Logitech Internet Navigator Keyboard & Blue MX510 Mouse

    :beer:

  4. #4
    Member
    Join Date
    May 2006
    Location
    CT
    The quick and dirty way would be
    Code:
    OrderForm = OrderForm & "Total Price: " + totalLabel.Text

    Gigabyte G1.Sniper 3 : i7 3770K : G.Skill Ripjaw X 16GB : Gigabyte GTX680 OC + eVGA 7800GT : Intel 520 180GB : Corsair HX750
    Windows 7 x64

  5. #5
    Registered lil layzie's Avatar
    Join Date
    Aug 2004
    quick and dirty eh lol.

    thanks for help.

    much appreciated
    A64 3400+ 1MB CH/CG | DFI Lanparty UT nF3 250GB | 1Gb (2x512MB) PC3500 OCZ EB
    EVGA GeForce 7800GS 256MB AGP | Creative SB Audigy2 ZS Platinum
    WD 74Gb Raptor | Maxtor 120Gb DiamondMax 9 | Sony CRX100E CD-RW
    OCZ Powerstream 520w PSU | Chieftec Black Dragon
    5x80m ThermalTake Thunderblades | 1x92m Zalman Quiet Fan
    Samsung SyncMaster 171v | Logitech Z-680 | Sennheiser PC 150
    Logitech Internet Navigator Keyboard & Blue MX510 Mouse

    :beer:

  6. #6
    New Member
    Join Date
    Oct 2008
    Quote Originally Posted by lil layzie View Post
    quick and dirty eh lol.

    thanks for help.

    much appreciated
    Just wanted to add in vb the proper way to check values would to actuall
    iterate through all the components and check their values...

    This way if you were to change the form dialog to include new items it would also be checked without adding to the code....

    http://stackoverflow.com/questions/1...ntainer-object

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •