By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,881 Members | 1,449 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,881 IT Pros & Developers. It's quick & easy.

possible to use Bang ! notation in place of "Not" keyword?

P: n/a
If Not st1.Equals("something") then
Do Something Else
End If

if str1 != "something" Then ...

I realize that != is C# stuff and/or can be also be used in Tsql, but is
there any implementation of bang ! in VB.Net? Just checking. Any samples
appreciated.

Thanks,
Rich
Apr 27 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
=?Utf-8?B?UmljaA==?= <Ri**@discussions.microsoft.comwrote in
news:E4**********************************@microsof t.com:
I realize that != is C# stuff and/or can be also be used in Tsql, but
is there any implementation of bang ! in VB.Net? Just checking. Any
samples appreciated.
That's C#.
Apr 27 '07 #2

P: n/a
On Apr 27, 12:22 pm, Rich <R...@discussions.microsoft.comwrote:
If Not st1.Equals("something") then
Do Something Else
End If

if str1 != "something" Then ...

I realize that != is C# stuff and/or can be also be used in Tsql, but is
there any implementation of bang ! in VB.Net? Just checking. Any samples
appreciated.

Thanks,
Rich
Perhaps you could define your own operators for !, !=, ==, ^, ||, &&, +
+, --, etc, but it seems like a pain to me.

Besides why not just do this?
if str != "something" Then
if str <"something" Then

Seems just as easy as using the C# notation to me.

Thanks,

Seth Rowe

Apr 27 '07 #3

P: n/a
I agree that <is just as easy !=. My issue was just to be more familiar
with VB.Net. So I was just checking if there was any implementation of !.
Like in VBA code you have Me!Text1, RS!fld1, ... so I am just checking if
there was any ! usage in VB.Net. It appears not - which is fine by me. But
I just wanted to make sure I'm not missing out on anything.

"rowe_newsgroups" wrote:
On Apr 27, 12:22 pm, Rich <R...@discussions.microsoft.comwrote:
If Not st1.Equals("something") then
Do Something Else
End If

if str1 != "something" Then ...

I realize that != is C# stuff and/or can be also be used in Tsql, but is
there any implementation of bang ! in VB.Net? Just checking. Any samples
appreciated.

Thanks,
Rich

Perhaps you could define your own operators for !, !=, ==, ^, ||, &&, +
+, --, etc, but it seems like a pain to me.

Besides why not just do this?
if str != "something" Then

if str <"something" Then

Seems just as easy as using the C# notation to me.

Thanks,

Seth Rowe

Apr 27 '07 #4

P: n/a
It's funny how those little things differ between languages. Until yesterday
I was still lamenting the fact that VB didn't have a ternary operator like C
does... testCondition?doIfTrue:doIfFalse;... but then I suddenly came upon
the IIF statement!

"Rich" <Ri**@discussions.microsoft.comwrote in message
news:14**********************************@microsof t.com...
>I agree that <is just as easy !=. My issue was just to be more familiar
with VB.Net. So I was just checking if there was any implementation of !.
Like in VBA code you have Me!Text1, RS!fld1, ... so I am just checking if
there was any ! usage in VB.Net. It appears not - which is fine by me.
But
I just wanted to make sure I'm not missing out on anything.

"rowe_newsgroups" wrote:
>On Apr 27, 12:22 pm, Rich <R...@discussions.microsoft.comwrote:
If Not st1.Equals("something") then
Do Something Else
End If

if str1 != "something" Then ...

I realize that != is C# stuff and/or can be also be used in Tsql, but
is
there any implementation of bang ! in VB.Net? Just checking. Any
samples
appreciated.

Thanks,
Rich

Perhaps you could define your own operators for !, !=, ==, ^, ||, &&, +
+, --, etc, but it seems like a pain to me.

Besides why not just do this?
if str != "something" Then

if str <"something" Then

Seems just as easy as using the C# notation to me.

Thanks,

Seth Rowe

Apr 27 '07 #5

P: n/a
Peter wrote:
It's funny how those little things differ between languages. Until yesterday
I was still lamenting the fact that VB didn't have a ternary operator like C
does... testCondition?doIfTrue:doIfFalse;... but then I suddenly came upon
the IIF statement!
Be aware that currently (VB 2005) IIF is just a regular function. This
means that it will evaluate its parameters previous to execution,
which differs from the way the ternary "?:" operator works. For
instance, the assignment bellow will raise an error when executed,
because A(0) is evaluated before IIf is called.

Dim A As List(Of Integer)
Dim B As Integer = IIf(A is Nothing, 0, A(0))

Also, IIF parameters and return type are Object, which takes away most
of its mojo.

Next VB.Net version is supposed to remedy both issues. ;-)

Regards,

Branco.

Apr 27 '07 #6

P: n/a
"Rich" <Ri**@discussions.microsoft.comschrieb:
If Not st1.Equals("something") then
Do Something Else
End If

if str1 != "something" Then ...

I realize that != is C# stuff and/or can be also be used in Tsql, but is
there any implementation of bang ! in VB.Net? Just checking. Any samples
appreciated.

Note that C# overloads the '==' and '!=' operators so that they work with
both value types and reference types. Thus it's not obious if value
equality or object identity is compared. Other programming languages, such
as VB, provide different operators for comparing (1) value equality and (2)
object identity.

In VB, the operators '=' and '<>' are used to compare for value equality and
'Is' and 'IsNot' (VB 2005) are used to compare for object identity.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Apr 28 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.