This is my project and I'm trying to calculate the total cost for gas for a chevy and a buick on a form. The total miles is 21 for city and 33 for freeway. I'm also putting in the mpg for each, for city and freeway. How would I set up the labels to display the right amount? Do I use If Then statements? Thanks!
What is the mileage and Total Miles? How do those get entered? You would certainly use an If statement to deal with the two radio button pairs. The outer If statement would be for the car, the inner If statement for both would be the Route. However, it seems like you would want a slightly more complicated model where part of the route is freeway and the rest is city, which wouldn't work with that interface, but I already don't see how mileage is entered.
What is the mileage and Total Miles? How do those get entered? You would certainly use an If statement to deal with the two radio button pairs. The outer If statement would be for the car, the inner If statement for both would be the Route. However, it seems like you would want a slightly more complicated model where part of the route is freeway and the rest is city, which wouldn't work with that interface, but I already don't see how mileage is entered.
That's what I'm trying to figure out, this is for an online class.
-The Buick gets 23.7 miles per gallon on the freeway and 15.5 miles per gallon in the city.
-The Chevy gets 29.3 miles per gallon on the freeway and 19.8 miles per gallon in the city.
-Freeway distance is 33 miles.
-City driving distance is 21 miles
So the numbers are constants and don't change. I just need to figure out how to get them to show up when the appropriate radio button is selected.
Oh, that does make it a bit simpler. It looks like you have those labels fairly well figured out, as the labels for mileage and total distance certainly look right. What do you have written?
Oh, that does make it a bit simpler. It looks like you have those labels fairly well figured out, as the labels for mileage and total distance certainly look right. What do you have written?
I haven't started yet. The image is just what I need my project to look like. My guess would be to write:
If BuickRadioButton.checked and
FreewayRadioButton.checked then
MileageLabel.Text = "15.5" and
TotalMilesLabel.Text = "21"
That does look more versatile than the default screen capture, but screen capture is pretty good for grabbing one whole form or the whole screen.
As for the If statements, those would work. You'd need a fair set of them, but you will anyway you write it. The one thing I would say is that you should use AndAlso rather than And.