Help with visual basic code?
Hi
Sorry if this is an simple question, WE probably must know the idea myself.
We would like help along with combo boxes, an example in the problem internet marketing having is say a new programme pertaining to an air-port, 1 mix box possesses departures additional has location.
Such as if MY SPOUSE AND I picked depart from ny..and vacation spot sydney, what value could my spouse and i use and so VB understands I picked new york and sydney, and the best way would MY SPOUSE AND I link these individuals together such as a label coming up saying Road:Ndew york for you to sydney in addition to put a cost on that will.
Thanks a lot to any one who aids.
This is definitely where item orient legitimate comes into play,
One approach could possibly be to generate an class object known as Flight that has properties named Arrival and Destination
The very first thing you could do is employ a button that say “Create New Flight” which could have code inside click event like so
‘this is usually psuedo code in order to get you the idea…I might write all of it….
dim myFlight seeing that Flight
myFlight=new Flight
myFlight.Destination=Combobox1.selected
myFlight.Arrival=Combobox2.selectedItem
other properties you should have are
TicketPrice
DepartureTime
ArrivalTime
Every Airline ticket you create may then be stored from a collection called Flights
You can then iterate through any flights as well as display these or one
dim myFlight seeing that Flight=nothing
per myFlight throughout myFlights
gaming console.out.writeln(“Dest:” & myFlight.Location & ” Birth:” & myFlight.Appearance & ” selling price:” & myFlight.TicketPrice)
next
Individual class Flight
myArrival as string
myDestination as string
end class
Individual class Flights
end class
***********additional Info*****************
Yes, every Airfare object a person instatiate could have it’s unique unique information for example
dim myFlight seeing that Flight=nothing
myFlight=new Flight
myFlight.Airline=”United”
myFlight.departure=”sydney”
myFlight.arrival=”NY”
myFlight.TicketPrice=”1000.00″
myFlights.add(myFlight)
myFlight=nothing
myFlight=new Flight
myFlight.Airline=”US AIR”
myFlight.departure=”sydney”
myFlight.arrival=”NY”
myFlight.TicketPrice=”900.00″
myFlights.add(myFlight)
myFlight=nothing
myFlight=new Flight
myFlight.Airline=”Delta”
myFlight.departure=”boston”
myFlight.arrival=”ca”
myFlight.TicketPrice=”450.00″
myFlights.add(myFlight)
myFlight=nothing
Here could be the code I recently tried out there on the computer.It’s got 2 comboboxes, a label as well as a button.WE placed NewYork within combobox JUST ONE, along with any other cities, and Sydney throughout combobox A COUPLE OF, along by using several cities.
After you select getaway and giving cities, simply click button ONE PARTICULAR.
Public Class Form1
Individual Sub Button1_Click(ByVal sender Because System.Object, ByVal electronic As System.EventArgs) Addresses Button1.Click
Label1.Wording = “Route:” & ComboBox1.Wording & ” for you to ” & ComboBox2.Wording & ” Selling price:” & Val( Text1.Text)
End Sub
End Class
EDIT
You must add the textbox during which to enter the retail price.I’ve tailored the computer code above to be able to reflect in which.If you don’t want saving this information for easily use in additional limitations, there’s non-in demand dimension that.
TexMav.
Leave a Reply
You must be logged in to post a comment.