Michael_85
Member
- Joined
- Mar 15, 2009
- Messages
- 9
- Programming Experience
- Beginner
Hi i have wrote code to output a message box tell user what they have seleted for pizza menu like thin base etc but i would now like to tell them how much the pizza will cost . so i would like to assign price to each items like deepPan cheese and so on i will show you the code i have wrote already if i have not followed rules of posting here or there is not enough detail please ask for anything else
VB.NET:
Private Sub btnOrderNow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOrderNow.Click
' Declare variable required
Dim m_strToppings As String 'To hold the toppings requested
Dim m_strPizzaType As String 'To identify the pizza type' chosen
m_strToppings = "" 'Set the string variable to empty
' Test for pizza type.
If rdoMargherita.Checked = True Then
m_strPizzaType = "Margherita"
Else
If rdoHawaiian.Checked = True Then
m_strPizzaType = "Hawaiian"
Else
If rdoSpicyBeef.Checked = True Then
m_strPizzaType = "SpicyBeef"
Else
If rdoPolloFunghi.Checked = True Then
m_strPizzaType = "PolloFunghi"
Else
m_strPizzaType = "Tropicana"
End If
End If
End If
End If
' Test which CHECK BOXES have been ticked and, if they
' have, add them to the list.
' N.B. If the user ticks a Check Box, its Value Property is
' set to 1. Also, the Caption Property value is added to
' the string variable.
If chkCheese.CheckState = 1 Then
m_strToppings = m_strToppings & chkCheese.Text & " "
End If
If chkPineapple.CheckState = 1 Then
m_strToppings = m_strToppings & chkPineapple.Text & " "
End If
If chkOnions.CheckState = 1 Then
m_strToppings = m_strToppings & chkOnions.Text & " "
End If
If chkPeppers.CheckState = 1 Then
m_strToppings = m_strToppings & chkPeppers.Text
End If
' Test which Base option button was clicked using the
' Checked property.
' N.B. Only ONE of the buttons can have the value TRUE!
If Me.rdoThin.Checked = True Then
MessageBox.Show("You chose " & m_strPizzaType & "with a Thin Crust and toppings :" & m_strToppings,"Pizza Types", MessageboxButtons.OK)
Else
MessageBox.Show("You chose " & m_strPizzaType & " with aDeep Crust and toppings :" &m_strToppings, "Pizza Types" , MessageBoxButtons.OK)
End If
End Sub
End Class
Last edited by a moderator: