Option Explicit Const intFirstCost As Integer = 350 Const intSecondCost As Integer = 200 Const intThirdCost As Integer = 100 Const intRussiaCost As Integer = 500 Const intMexicoCost As Integer = 350 Const intUsaCost As Integer = 200 Const intCubaCost As Integer = 250 Dim intFirstClass As Integer Dim intSecondClass As Integer Dim intThirdClass As Integer Dim intNumberofSeats1 As Integer Dim intNumberofSeats2 As Integer Dim intNumberofSeats3 As Integer Dim intTotal As Integer Private Sub Cmbdestinations_Click() If intNumberofSeats1 = Txtnumseats.Text And Cmbdestinations.Text = "Moscow,Russia" Then intTotal = intNumberofSeats1 * (intFirstCost + intRussiaCost) ElseIf intNumberofSeats1 = Txtnumseats.Text And Cmbdestinations.Text = "Washington,Usa" Then intTotal = intNumberofSeats1 * (intFirstCost + intUsaCost) ElseIf intNumberofSeats1 = Txtnumseats.Text And Cmbdestinations.Text = "Havana,Cuba" Then intTotal = intNumberofSeats1 * (intFirstCost + intCubaCost) ElseIf intNumberofSeats1 = Txtnumseats.Text And Cmbdestinations.Text = "Mexico city,Mexico" Then intTotal = intNumberofSeats1 * (intFirstCost + intMexicoCost) ElseIf intNumberofSeats2 = Txtnumseats.Text And Cmbdestinations.Text = "Moscow,Russia" Then intTotal = intNumberofSeats2 * (intSecondCost + intRussiaCost) ElseIf intNumberofSeats2 = Txtnumseats.Text And Cmbdestinations.Text = "Washington,Usa" Then intTotal = intNumberofSeats2 * (intSecondCost + intUsaCost) ElseIf intNumberofSeats2 = Txtnumseats.Text And Cmbdestinations.Text = "Havana,Cuba" Then intTotal = intNumberofSeats2 * (intSecondCost + intCubaCost) ElseIf intNumberofSeats2 = Txtnumseats.Text And Cmbdestinations.Text = "Mexico city,Mexico" Then intTotal = intNumberofSeats2 * (intSecondCost + intMexicoCost) ElseIf intNumberofSeats3 = Txtnumseats.Text And Cmbdestinations.Text = "Moscow,Russia" Then intTotal = intNumberofSeats3 * (intThirdCost + intRussiaCost) ElseIf intNumberofSeats3 = Txtnumseats.Text And Cmbdestinations.Text = "Washington,Usa" Then intTotal = intNumberofSeats3 * (intThirdCost + intUsaCost) ElseIf intNumberofSeats3 = Txtnumseats.Text And Cmbdestinations.Text = "Havana,Cuba" Then intTotal = intNumberofSeats3 * (intThirdCost + intCubaCost) ElseIf intNumberofSeats3 = Txtnumseats.Text And Cmbdestinations.Text = "Mexico city,Mexico" Then intTotal = intNumberofSeats3 * (intThirdCost + intMexicoCost) End If End Sub Private Sub cmdtotal_Click() lbltotalprice.Caption = Format(intTotal, "currency") End Sub Private Sub Form_Load() Randomize intFirstClass = Int(3 * Rnd + 1) lblseats1.Caption = intFirstClass intSecondClass = Int(12 * Rnd + 3) lblseats2.Caption = intSecondClass intThirdClass = Int(15 * Rnd + 15) lblseats3.Caption = intThirdClass Cmbdestinations.AddItem "Moscow,Russia" Cmbdestinations.AddItem "Washington,Usa" Cmbdestinations.AddItem "Havana,Cuba" Cmbdestinations.AddItem "Mexico City, Mexico" End Sub Private Sub optfirst_Click() Txtnumseats.Text = "" Cmbdestinations.Text = "Destinations" End Sub Private Sub optsecond_Click() Txtnumseats.Text = "" Cmbdestinations.Text = "Destinations" End Sub Private Sub optthird_Click() Txtnumseats.Text = "" Cmbdestinations.Text = "Destinations" End Sub Private Sub Txtnumseats_Change() Cmbdestinations.Text = "Destinations" If Txtnumseats.Text = "" Then Exit Sub End If If optfirst.Value = True Then intNumberofSeats1 = Txtnumseats.Text If intNumberofSeats1 > intFirstClass Then intNumberofSeats1 = intFirstClass Txtnumseats.Text = intNumberofSeats1 End If ElseIf optsecond.Value = True Then intNumberofSeats2 = Txtnumseats.Text If intNumberofSeats2 > intSecondClass Then intNumberofSeats2 = intSecondClass Txtnumseats.Text = intNumberofSeats2 End If ElseIf optthird.Value = True Then intNumberofSeats3 = Txtnumseats.Text If intNumberofSeats3 > intThirdClass Then intNumberofSeats3 = intThirdClass Txtnumseats.Text = intNumberofSeats3 End If Else MsgBox "Please select a class" Txtnumseats.Text = "" End If lbltotalprice.Caption = "" End Sub
AS you can see, i have have made an effort to make this program, it works however i do not think it
is "user friendly enough" because you can only choose in 1 order (1.class 2. num of seats, 3. destination), and if you choose in any other order there will be an error. Can someone show me how fix that.
Also, i need a "user defined" function in there, but do not know how to do that since i am a begginer.
IT WILL BE VERY APRRICIATIVE IF YOU PLEASE HELP QUICK!!!
to see screenshot of the INTERFACE copy and paste this to you're address bar
http://img413.images...nterfacefw2.png
This post has been edited by artemster: 18 January 2009 - 10:34 PM

New Topic/Question
Reply




MultiQuote




|