473,910 Members | 7,672 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 8572
>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
2267
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
11754
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
2381
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
3723
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
9425
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 that is possible is there away I can get that to be emailed via my smtp server? Many thanks, ...
0
9879
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11349
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10921
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9727
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8099
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7250
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6142
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4337
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3360
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.