Making some thing happen when a number is less than zero

How do you make something happen if a number is less than zero.

If Number < 0 Then Break // Happen Else // Go on, making nothing happen End If

Dim i as integer


If i < 0 then msgbox “Too low”

You may also want to look at computed properties.

They are the answer if your question means something like

’ When the user sets the value of dfBankAccount to zero, then I want to send an email’

What you do is create a computed property (maybe called dfBankAccount), with a Get and a Let pair of methods.
Inside the Let method, if the value being set is zero, you can call another method, send an email, throw up a messagebox, or anything you like.

That doesnt happen simply by setting a normal integer variable to zero.

What I made subtracts from a number when you click a button but I don’t want some one to be able to make it go below zero

Then in the action event before you return put something like this:

If myValue < 0 Then myValue = 0 End If

Another way would be

myValue = Max(0, myValue)

I tend to do the Max option here. Drives my coworkers nuts as they prefer an explicit conditional apart from assignment.

I just figured it out by putting in Cash.Text.Val <0