Standard
Standard

Reputation: 21

How to write 'not greater than zero' in VB.NET

How should I write not greater than 0 in VB.NET?

psuedocode:

if x is not greater than 0 then
  do something
end if

Upvotes: 2

Views: 9939

Answers (7)

Nilesh Sarkale
Nilesh Sarkale

Reputation: 59

dim X as decimal

if x<0  then

end if

Upvotes: 0

Harvy Derage
Harvy Derage

Reputation: 21

Try this

  dim x as integer = -1

  If x < 0 OrElse x = 0 Then
        'Do something in here
  End If

if value of x is less than 0 or equal to 0 but not greater than 0 it will trigger the 'Do something in here

You can just change the value of the integer x from -1 to anything you want

Upvotes: 0

betrice mpalanzi
betrice mpalanzi

Reputation: 1117

try this like

If Not ListBox1.SelectedIndex < 0 Then

      'do something
    Else

do some thing End If

Upvotes: 0

nos
nos

Reputation: 229108

If it's not greater than 0, it's less than or equal:

If x <= 0 Then
   ...
End If

Upvotes: 1

Sachin Shanbhag
Sachin Shanbhag

Reputation: 55489

if x <= 0

Would this not do for you? Simplest and easiest way of saying "Not greater than"

Upvotes: 1

Phoenix
Phoenix

Reputation: 4536

If something is not greater than something, then it is less than or equal to it. So x <= 0.

Upvotes: 9

BlackBear
BlackBear

Reputation: 22979

if x is smaller or equal than 0 maybe?

Upvotes: 1

Related Questions