"Does Not Equal"

Does this exist in VB.NET?

Page 1 of 1

3 Replies - 40026 Views - Last Post: 03 December 2009 - 12:51 AM Rate Topic: -----

#1 CheckersW  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 12
  • View blog
  • Posts: 198
  • Joined: 04-April 09

"Does Not Equal"

Posted 02 December 2009 - 03:05 PM

Hi all.

Is there a function in VB.NET for "does not equal"?

For example, at the moment, if I wanted to check that a value was valid (i.e. equalled 0) I would type:

If Label1.Text = "0" Then

Else : MessageBox.Show("Input error")
EndIf



But is there a function for does not equal?

eg:
If Lable1.Text != "0" Then MessageBox.Show ("Input error")



Thanks

Is This A Good Question/Topic? 0
  • +

Replies To: "Does Not Equal"

#2 bflosabre91  Icon User is offline

  • go sabres

Reputation: 105
  • View blog
  • Posts: 1,439
  • Joined: 22-February 08

Re: "Does Not Equal"

Posted 02 December 2009 - 03:07 PM

use <>

if lbl.text <> "this" then 
'do this
end if


Was This Post Helpful? 1
  • +
  • -

#3 mikeymike  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 14
  • Joined: 30-November 09

Re: "Does Not Equal"

Posted 02 December 2009 - 04:56 PM

The poster above me is correct, here are some other operators for your reference:
=	Tests whether two values are equal.
<>	Tests whether two values are not equal.
<	Tests whether the first value is less than the second value.
>	Tests whether the first value is greater than the second value.
<=	Tests whether the first value is less than or equal to the second value.
>=	Tests whether the first value is greater than or equal to the second value


Was This Post Helpful? 0
  • +
  • -

#4 motcom  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 290
  • View blog
  • Posts: 1,371
  • Joined: 16-June 08

Re: "Does Not Equal"

Posted 03 December 2009 - 12:51 AM

Hi,

You can also use the "Not" statement

   If Not lbl.text = "this" Then
	  'do this
   End If



;)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1