Кнопка отправки Visual Basic с групповым полем и переключателями - PullRequest
0 голосов
/ 10 декабря 2018

Я пользуюсь Visual Basic, и у меня возникли проблемы с получением формы для составления итоговой цены продуктов, выбранных путем выбора радиокнопки в списке. Любые предложения о том, что я могу делать не так, делая неправильно?ПОЖАЛУЙСТА, ПОМОГИТЕ МНЕ !!

Опция Strict On Public Class frmPTsGrille

Private Sub btnSubmit_Click(sender As Object, e As EventArgs) Handles btnSubmit.Click
    'The btnSubmit_Click event accepts the selection of a single sandwich drink 
    'and condiments selected by a customer for order. Then totals the cost 
    'and also, displays the price of the selections for the the customers order.
    'declare and initialize variables
    Dim decSandwichCost As Decimal
    Dim decTotalCost As Decimal
    Dim decDrinkCost As Decimal

    Const decOLDEBURGER_COST As Decimal = 6.67D
    Const decPT_COST As Decimal = 4.82D
    Const decGRILLEDCHICKEN_COST As Decimal = 6.54D
    Const decROAST_COST As Decimal = 5.84D
    Const decGARDEN_COST As Decimal = 5.65D
    Const decBEAN_COST As Decimal = 5.84D
    Const decDOG_COST As Decimal = 4.67D
    Const decTURKEY_COST As Decimal = 5.65D
    Const decBLT_COST As Decimal = 4.67D
    Const decGRILLED_COST As Decimal = 3.97D
    Const decLEMONADE_COST As Decimal = 1.87D
    Const decSIERRA_COST As Decimal = 1.63D
    Const decPEPPER_COST As Decimal = 1.63D
    Const decROOTBEER_COST As Decimal = 1.63D
    Const decDIET_COST As Decimal = 1.63D
    Const decSWEET_COST As Decimal = 1.63D
    Const decUNSWEET_COST As Decimal = 1.63D
    Const decDEW_COST As Decimal = 1.63D
    Const decWATER_COST As Decimal = 0.00D



    If radToGo.Checked = True Then
        If radOldeBurger.Checked = True Then
            decSandwichCost = decOLDEBURGER_COST
        ElseIf radPT.Checked = True Then
            decSandwichCost = decPT_COST
        ElseIf radGrilledChicken.Checked = True Then
            decSandwichCost = decGRILLEDCHICKEN_COST
        ElseIf radRoast.Checked = True Then
            decSandwichCost = decROAST_COST
        ElseIf radGarden.Checked = True Then
            decSandwichCost = decGARDEN_COST
        ElseIf radBean.Checked = True Then
            decSandwichCost = decBEAN_COST
        ElseIf radDog.Checked = True Then
            decSandwichCost = decDOG_COST
        ElseIf radTurk.Checked = True Then
            decSandwichCost = decTURKEY_COST
        ElseIf radBLT.Checked = True Then
            decSandwichCost = decBLT_COST
        ElseIf radCheese.Checked = True Then
            decSandwichCost = decGRILLED_COST

        ElseIf chkLemonade.Checked = True Then
            decDrinkCost = decLEMONADE_COST
        ElseIf chkDew.Checked = True Then
            decDrinkCost = decDEW_COST
        ElseIf chkDietPepsi.Checked = True Then
            decDrinkCost = decDIET_COST
        ElseIf chkSierra.Checked = True Then
            decDrinkCost = decSIERRA_COST
        ElseIf chkSierra.Checked = True Then
            decDrinkCost = decPEPPER_COST
        ElseIf chkRootbeer.Checked = True Then
            decDrinkCost = decROOTBEER_COST
        ElseIf chkSweetTea.Checked = True Then
            decDrinkCost = decSWEET_COST
        ElseIf chkUnsweetTea.Checked = True Then
            decDrinkCost = decUNSWEET_COST
        ElseIf chkSierra.Checked = True Then
            decDrinkCost = decSIERRA_COST
        ElseIf chkDietPepsi.Checked = True Then
            decDrinkCost = decSIERRA_COST
        ElseIf chkWater.Checked = True Then
            decDrinkCost = decWATER_COST
        End If
    End If


    decTotalCost = decSandwichCost + decDrinkCost
    lblTotalCost.Text = decTotalCost.ToString("c")



End Sub

Private Sub FrmPTsGrille_Load(sender As Object, e As EventArgs) Handles Me.Load
    txtName.Focus()
    lblTotalCost.Text = ""
    radOldeBurger.Checked = True
    chkWater.Checked = True
End Sub

Конечный класс

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...