I am doing an assignment that requires me to have 4 different radio button(earth, moon, jupiter and saturn) and two labels one showing the weight (on different planet) and one for the delivery price ( $5.00 for weights up to 1 kg; $10.00 for higher than 1 kg up to 2 kg; $20.00 for higher than 2kg up to 5 kg; $35.00 for higher than 5kg up to 10 kg. For weights higher than 10 kg display message " too heavy to send."(in label for price) therefore when a command button is clicked, it will compute and show the weight of the package on the planet chosen by radio button

Can someone just use one example for one of the planet? I have no idea how I would start the code.

Please help me out, thank you

Recommended Answers

All 7 Replies

Okay, I'm guessing that weight calculations are based upon earth standard normal, which means that based upon a packages weight being sent to the moon you would multiply it by .6 to get its destination weight, which is what I believe to be your excercise. From there you can use the select statement or a series of if elseif's to test that destination weight to calcualte the price. Once that is done, then you will be able to display the results...

Good Luck

Okay, I'm guessing that weight calculations are based upon earth standard normal, which means that based upon a packages weight being sent to the moon you would multiply it by .6 to get its destination weight, which is what I believe to be your excercise. From there you can use the select statement or a series of if elseif's to test that destination weight to calcualte the price. Once that is done, then you will be able to display the results...

Good Luck

I came up with a code like this:
Select Case Expression
Case optMoon.Value = yes
lblweight.Caption = "New weight: " & Val(txtweight) * Val(0.167)

But I have another label box which shows the price, if the weight is (or lower) 0~1 than the price will be $5. What would the code be? Case is or case else??
Thank you for your reply

You will probably want to go with an if elseif structure...

If Weight <= 1 then
ElseIf Weight > 1 And Weight <=2 Then
'...

Good Luck

You will probably want to go with an if elseif structure...

If Weight <= 1 then
ElseIf Weight > 1 And Weight <=2 Then
'...

Good Luck

I used the above code but the error message keeps popping up saying "else without if" ? And I can use both case and if at the sametime?

The reason it is giving you that error is because I did not complete the if elseif end if structure as it was only to be an example for you to do your own codeing.... not only to complete the structure for the remaiing weights but also the else and end if...


Good Luck

The reason it is giving you that error is because I did not complete the if elseif end if structure as it was only to be an example for you to do your own codeing.... not only to complete the structure for the remaiing weights but also the else and end if...


Good Luck

I know that I am suppose to type End If when Im using the code if however I still have the error message popping up.
My struture was like If...then elseif... (etc)end if end sub. My program for weight is working but still not the price, however my assignment is due today..I'll just hand it in as it is.

Thank you for all the help.

Did you miss the End Select?


Good Luck

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.