Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


b0untypure1

1426 posts

Uber Geek


#68478 22-Sep-2010 19:22
Send private message

hi there,
i have some coding for Vb6 as follows

'lets start on vanweight issue

vanweight2 = Val(frmReceipt.lblWeight.Caption)

vanweight = vanweight + vanweight2 'sets weight to add on each time to vanweight
vanleft = (250 - vanweight)



If vanleft < 0 Then
MsgBox ("VAN OVERLOAD"), vbOKOnly + vbExclamation, " Van Capacity Has Been Exceeded"
frmTicket.Show 'takes user back to ticket form
Unload frmReceipt 'unloads receipt form



The problem im having is when the variable "vanleft" is below 0 (in the if statement above)
the message box with VAN OVERLOAD comes up perfectly, however the value of vanleft remains below zero. Im looking for help on how to leave vanleft unchanged if vanleft < 0

for example, a user enters 3 values for weight

50kg
100kg
110kg

the result for vanleft will be (250-50-100-110) vanleft = -10

when vanleft is below 0, i want the last value to be removed. So when a user puts these 3 values in, the message box appears, to say van overload, then the value they LAST input, is removed. and vanleft will only equal 150kg.

please help me, i have spent hours looking at this code :S
thanks in advance




gz ftw


Create new topic
jbard
1377 posts

Uber Geek


  #383331 22-Sep-2010 19:56
Send private message

ok i think i understand your question, you just need to modify the if statement:

If vanweight - 250 > 0 Then

vanleft = (250 - vanweight) //add this inside the if statement


Else //vanleft would be less than 0 so error

MsgBox ("VAN OVERLOAD"), vbOKOnly + vbExclamation, " Van Capacity Has Been Exceeded"
frmTicket.Show 'takes user back to ticket form
Unload frmReceipt 'unloads receipt form


Hope this helps :)



b0untypure1

1426 posts

Uber Geek


  #383335 22-Sep-2010 20:11
Send private message

your a legend !
thanks very much mate.

i understand what i did now... i always had the vanleft variable resulting in a number below 0.
all sorted now and going good.
have a good night




gz ftw


b0untypure1

1426 posts

Uber Geek


  #383336 22-Sep-2010 20:11
Send private message

woot 300th post :D




gz ftw




jbard
1377 posts

Uber Geek


  #383337 22-Sep-2010 20:11
Send private message

no worries :)

Create new topic





News and reviews »

Air New Zealand Starts AI adoption with OpenAI
Posted 24-Jul-2025 16:00


eero Pro 7 Review
Posted 23-Jul-2025 12:07


BeeStation Plus Review
Posted 21-Jul-2025 14:21


eero Unveils New Wi-Fi 7 Products in New Zealand
Posted 21-Jul-2025 00:01


WiZ Introduces HDMI Sync Box and other Light Devices
Posted 20-Jul-2025 17:32


RedShield Enhances DDoS and Bot Attack Protection
Posted 20-Jul-2025 17:26


Seagate Ships 30TB Drives
Posted 17-Jul-2025 11:24


Oclean AirPump A10 Water Flosser Review
Posted 13-Jul-2025 11:05


Samsung Galaxy Z Fold7: Raising the Bar for Smartphones
Posted 10-Jul-2025 02:01


Samsung Galaxy Z Flip7 Brings New Edge-To-Edge FlexWindow
Posted 10-Jul-2025 02:01


Epson Launches New AM-C550Z WorkForce Enterprise printer
Posted 9-Jul-2025 18:22


Samsung Releases Smart Monitor M9
Posted 9-Jul-2025 17:46


Nearly Half of Older Kiwis Still Write their Passwords on Paper
Posted 9-Jul-2025 08:42


D-Link 4G+ Cat6 Wi-Fi 6 DWR-933M Mobile Hotspot Review
Posted 1-Jul-2025 11:34


Oppo A5 Series Launches With New Levels of Durability
Posted 30-Jun-2025 10:15









Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.