• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

I need a little help with a Visual Basic .NET program

XBoxLPU

Diamond Member
I have the program working 100% just fine. The only annoyance is that when I hit the computate button, I have to hit it twice for the actual computation to work. IE, when I first load up the program, select one of the 4 choices from the combobox dropdown, input some values, the result comes up 0, but I hit compute again it shows the correct value

Hmmm ???

 
The Select Case statement that does the calculation for V occurs after you convert V into the Volume variable and put it into your result string. One a second click of the compute button the variable V still has its old value.
 
Originally posted by: oog
The Select Case statement that does the calculation for V occurs after you convert V into the Volume variable and put it into your result string. One a second click of the compute button the variable V still has its old value.

n/m

I got it! Put the convert to string for voume after the calcuation, then the messagebox stuff!


Thanks
 
If you did this, what would you expect to happen?

Volume = V
V = L*W*H
MessageBox.Show(Volume, "Volume")

You are copying V into Volume, changing V, and then displaying Volume. Changing V obviously has no effect on Volume in case that's the area of confusion. You need to do all your operations to calculate V and THEN put that into your string.

And to answer your question about why all your other variables work, it's because you initialize them with the correct values BEFORE constructing your string which you don't do with V.
 
Back
Top