Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Programming styles and Loops...For/Next and Do Until/Do While

VBhelper2014VBhelper2014 WisconsinPosts: 1Member

I can't figure out how to get my loops to work to pull into list box. Want to calculate distance. User provides speed and hours traveled. 1. Have to prompt user for speed (MPH), must be a whole number greater than zero, if invalid messagebox, exit sub. 2. Have to prompt use for time traveled (hours), must be whole number and greater than zero, if invalid messagebox, exit sub.

Need to code the click events for (4) buttons BtnA-has to use FOR/NEXT and list items in ascending order BtnB-has to use FOR/NEXT and list items in descending order BtnC-has to use DO/WHILE and list items in ascending order BtnD-has to use DO/UNTIL and list items in descending order

List box results have to use a loop to display the distance the vehicle has traveled for each hour of that time period, like this: Vehicle Speed: 63 MPH Distance Traveled: 7 hours Hours Distance Traveled .............................................. 1 63 2 126 3 189 4 252 5 315 6 378 7 441 Total Distance: 441

Thank you in advance if you can help me...I don't know what I'm doing wrong and I've been working at it for way too long!!

Comments

  • VBhelper2014VBhelper2014 WisconsinPosts: 1Member

    I can't figure out how to get my loops to work to pull into list box. Want to calculate distance. User provides speed and hours traveled. 1. Have to prompt user for speed (MPH), must be a whole number greater than zero, if invalid messagebox, exit sub. 2. Have to prompt use for time traveled (hours), must be whole number and greater than zero, if invalid messagebox, exit sub.

    Need to code the click events for (4) buttons

    BtnA-has to use FOR/NEXT and list items in ascending order

    BtnB-has to use FOR/NEXT and list items in descending order

    BtnC-has to use DO/WHILE and list items in ascending order

    BtnD-has to use DO/UNTIL and list items in descending order

    List box results have to use a loop to display the distance the vehicle has traveled for each hour of that time period, like this:

    Vehicle Speed: 63 MPH

    Distance Traveled: 7 hours

    Hours Distance Traveled

    ..............................................

    1 63

    2 126

    3 189

    4 252

    5 315

    6 378

    7 441

    Total Distance: 441

    Thank you in advance if you can help me...I don't know what I'm doing wrong and I've been working at it for way too long!!

Sign In or Register to comment.