473,547 Members | 2,642 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

vbNullString

Lou
What's the .NET equivalent

Dim strTmp as string
If strTmp=vbNullSt ring

Mar 6 '07 #1
11 8545
>What's the .NET equivalent
>
Dim strTmp as string
If strTmp=vbNullSt ring
If strTmp Is Nothing Then
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Mar 6 '07 #2
String.Empty

Robin S.
-------------------------
"Lou" <lo********@com cast.netwrote in message
news:eb******** ******@TK2MSFTN GP04.phx.gbl...
What's the .NET equivalent

Dim strTmp as string
If strTmp=vbNullSt ring

Mar 7 '07 #3
String.Empty <="" (or any uninitialized As String variable or parameter in
VB6)
null <=vbNullStrin g (very rare, typically only use in native interops)

"RobinS" <Ro****@NoSpam. yah.nonewrote in message
news:zb******** *************** *******@comcast .com...
String.Empty

Robin S.
-------------------------
"Lou" <lo********@com cast.netwrote in message
news:eb******** ******@TK2MSFTN GP04.phx.gbl...
>What's the .NET equivalent

Dim strTmp as string
If strTmp=vbNullSt ring


Mar 7 '07 #4
I don't understand what <=means. Does that mean less than, equal to, and
greater than?

I assumed the OP was asking about converting vbNullString from VB6 to
VB.Net.

Null does not equal vbNullString in VB6. They are two completely different
things.

String.Empty is the replacement for vbNullString.

String.Empty = ""
Nothing = ""
String.Empty = Nothing --True

Note that you can not do this:

Dim str As String
Debug.Print(str )

You *must* assign a value to str before you can display or print it, even
if it's String.Empty. For this reason, many people initialize their strings
like this:

Dim str As String = String.Empty

Robin S.
-----------------------------
"Dr. Jochen Manns" <de***@psimarro n.netwrote in message
news:45******** *************** @news.freenet.d e...
String.Empty <="" (or any uninitialized As String variable or parameter
in VB6)
null <=vbNullStrin g (very rare, typically only use in native interops)

"RobinS" <Ro****@NoSpam. yah.nonewrote in message
news:zb******** *************** *******@comcast .com...
>String.Empty

Robin S.
-------------------------
"Lou" <lo********@com cast.netwrote in message
news:eb******* *******@TK2MSFT NGP04.phx.gbl.. .
>>What's the .NET equivalent

Dim strTmp as string
If strTmp=vbNullSt ring



Mar 7 '07 #5
On Tue, 6 Mar 2007 23:23:32 -0800, RobinS wrote:
I don't understand what <=means. Does that mean less than, equal to, and
greater than?

I assumed the OP was asking about converting vbNullString from VB6 to
VB.Net.

Null does not equal vbNullString in VB6. They are two completely different
things.

String.Empty is the replacement for vbNullString.

String.Empty = ""
Nothing = ""
String.Empty = Nothing --True

Note that you can not do this:

Dim str As String
Debug.Print(str )

You *must* assign a value to str before you can display or print it, even
if it's String.Empty. For this reason, many people initialize their strings
like this:

Dim str As String = String.Empty

Robin S.
Hey Robin,

vbNullString is not equal to String.Empty. String.Empty equates to "", the
zero length string. The MSDN documentation specifically states that
vbNullString is not the same as a zero-length string.

I think the closest thing would be nothing

--
Bits.Bytes
http://bytes.thinkersroom.com
Mar 7 '07 #6
"Rad [Visual C# MVP]" <no****@nospam. comwrote in message
news:1n******** *******@thinker sroom.com...
On Tue, 6 Mar 2007 23:23:32 -0800, RobinS wrote:
>I don't understand what <=means. Does that mean less than, equal to,
and
greater than?

I assumed the OP was asking about converting vbNullString from VB6 to
VB.Net.

Null does not equal vbNullString in VB6. They are two completely
different
things.

String.Empty is the replacement for vbNullString.

String.Empty = ""
Nothing = ""
String.Empty = Nothing --True

Note that you can not do this:

Dim str As String
Debug.Print(str )

You *must* assign a value to str before you can display or print it,
even
if it's String.Empty. For this reason, many people initialize their
strings
like this:

Dim str As String = String.Empty

Robin S.

Hey Robin,

vbNullString is not equal to String.Empty. String.Empty equates to "",
the
zero length string. The MSDN documentation specifically states that
vbNullString is not the same as a zero-length string.

I think the closest thing would be nothing

--
Bits.Bytes
http://bytes.thinkersroom.com
So here's my algebraic thinking.

In vb6: ?vbNullString = "" --true
In VB.Net: ?String.Empty = "" --true
(?Nothing = "" --true, so this is weird)

Algebraically speaking, if (a = b) and (b = c) then (a = c).

Therefore, if (vbNullString = '") and ("" = String.Empty),
then (vbNullString = String.Empty).

That's my theory!

Unless algebra doesn't hold true for .Net programming, in which I'm
screwed.

Robin S.
Mar 8 '07 #7
Being a VB developer (since vb3), I hereby confirm that vbNullString is
equivalent to Nothing. And a "nulled" variable is equivalent to
String.Empty

Here's an ASP.NET scenario:

Page 1 submits FormField1 to Page 2. FormField1 is an empty textbox. Page
1 posts to Page 2.
Page 2 instantiates a variable, varField1.
varField1 = Request.Form("F ormField1") results in varField1 = String.Empty
BUT
varField1 = Request.Form("F ormField2") .. which does not exist... then
varField1 = Nothing (not an empty string, but just no value assigned).

I have run across this conundrum several times in my career, and it always
amazes me how C-based developers don't see the difference =o)

- nasser

"Rad [Visual C# MVP]" <no****@nospam. comwrote in message
news:1n******** *******@thinker sroom.com...
On Tue, 6 Mar 2007 23:23:32 -0800, RobinS wrote:
>I don't understand what <=means. Does that mean less than, equal to,
and
greater than?

I assumed the OP was asking about converting vbNullString from VB6 to
VB.Net.

Null does not equal vbNullString in VB6. They are two completely
different
things.

String.Empty is the replacement for vbNullString.

String.Empty = ""
Nothing = ""
String.Empty = Nothing --True

Note that you can not do this:

Dim str As String
Debug.Print(str )

You *must* assign a value to str before you can display or print it, even
if it's String.Empty. For this reason, many people initialize their
strings
like this:

Dim str As String = String.Empty

Robin S.

Hey Robin,

vbNullString is not equal to String.Empty. String.Empty equates to "", the
zero length string. The MSDN documentation specifically states that
vbNullString is not the same as a zero-length string.

I think the closest thing would be nothing

--
Bits.Bytes
http://bytes.thinkersroom.com
Mar 8 '07 #8
"RobinS" posted...
: So here's my algebraic thinking.
:
: In vb6: ?vbNullString = "" --true
: In VB.Net: ?String.Empty = "" --true
: (?Nothing = "" --true, so this is weird)
:
: Algebraically speaking, if (a = b) and (b = c) then (a = c).
:
: [...]
:
: Unless algebra doesn't hold true for .Net programming, in which
: I'm screwed.

Golly Gee Batman!

Not True <False!
Not False <True!

If (a = True), (b = False), (c = True) Then
a + b = c and
b + c = c
b + c = a

Algebra does not apply! What shall we call the Screwy one,
Batman?!?

Screwballs, Robin!

--
Jim Carlock
Post replies to the group.
Mar 8 '07 #9
"Jim Carlock" <anonymous@loca lhostwrote in message
news:ub******** *****@TK2MSFTNG P04.phx.gbl...
"RobinS" posted...
: So here's my algebraic thinking.
:
: In vb6: ?vbNullString = "" --true
: In VB.Net: ?String.Empty = "" --true
: (?Nothing = "" --true, so this is weird)
:
: Algebraically speaking, if (a = b) and (b = c) then (a = c).
:
: [...]
:
: Unless algebra doesn't hold true for .Net programming, in which
: I'm screwed.

Golly Gee Batman!

Not True <False!
Not False <True!

If (a = True), (b = False), (c = True) Then
a + b = c and
b + c = c
b + c = a

Algebra does not apply! What shall we call the Screwy one,
Batman?!?

Screwballs, Robin!

--
Jim Carlock
Post replies to the group.

-----------------------------------

Holy Pythagorean Theorem, Batman! It's a nutcase!

Robin S.
Mar 8 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

43
2188
by: ZillionDollarSadist | last post by:
Hello, I'm working at a simple Access '97 + VB4 application, and I ran into a terrible problem: something I never modified now gives me a totally unwanted "Invalid use of null" error. It happens in a Text.LostFocus event, this block: Do While Not TB6.EOF If Year(TB6(0)) = Val(Trim(Text1.Text)) Then !!!!!!!!!!!!!Here!!!!!!!!! ...
3
11667
by: Larry | last post by:
Hi all, I am coming over from VB 6, learning VB.NET. I have read and have in front of me, the language reference from the msdn, on; Behavior of Null has changed, Isdbnull function and isnothing function. However, I am still at a loss to know excatly what to do.
6
2374
by: Tark Siala | last post by:
hi lasr years i use vb6 to make my Application Database with ADO, this days i use VB.NET to working with Database. to know if Field contain null i use: if recordset.field("data").value = vbnullstring then ..... but when i use VB.Net and working with Database this command not working, any one know how do it in VB.NET? -----------
13
3697
by: Lou | last post by:
What's the .NET equivalent Dim strTmp as string If strTmp=vbNullString Posted this earlier in the wrong Newsgroup.
10
9395
by: Dollarstar | last post by:
I've been looking around and I got some info but not to what I really need. I have a Database with several values, one being a date. When four days have passed from this date I get a warning message. Is there a way to to display which forms have this warning at present and display it somewhere, like in a report or another form. Also if...
0
7510
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7703
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7463
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7797
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5362
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3493
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3473
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1050
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
748
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.