Reputation: 21
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
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
Reputation: 1117
try this like
If Not ListBox1.SelectedIndex < 0 Then
'do something
Else
do some thing
End If
Upvotes: 0
Reputation: 229108
If it's not greater than 0, it's less than or equal:
If x <= 0 Then
...
End If
Upvotes: 1
Reputation: 55489
if x <= 0
Would this not do for you? Simplest and easiest way of saying "Not greater than"
Upvotes: 1
Reputation: 4536
If something is not greater than something, then it is less than or equal to it. So x <= 0
.
Upvotes: 9