473,396 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Empty string!

Very basic question!!

How do i check for an empty string in vb.net?

Ie:

If(e.Item.DataItem.Item(3) ?) Then
End If

I have already tried checking for a System.DBNull but the expression is
achieving what i am after
as e.Item.DataItem.Item(3) doesn't appear to be returning a dbnull if it is
empty.
It appears to be returning an empty string.

Adam..

Nov 19 '05 #1
3 1803
"Adam Knight" <ad**@pertrain.com.au> wrote in news:eeTl57iwFHA.3720
@TK2MSFTNGP14.phx.gbl:
Very basic question!!

How do i check for an empty string in vb.net?

Ie:

If(e.Item.DataItem.Item(3) ?) Then


Try

If(e.Item.DataItem.Item(3)) <> "" then
You might also want to "trim" the string before comparison.
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.

Newmarket Volvo Sucks! http://newmarketvolvo.tripod.com
Nov 19 '05 #2
My solution:

If(e.Item.DataItem.Item(0) = String.Empty) Then

'hide table row
tblListItem.Rows(1).Visible = False

End If

Is this reasonable??

"Adam Knight" <ad**@pertrain.com.au> wrote in message
news:ee**************@TK2MSFTNGP14.phx.gbl...
Very basic question!!

How do i check for an empty string in vb.net?

Ie:

If(e.Item.DataItem.Item(3) ?) Then
End If

I have already tried checking for a System.DBNull but the expression is
achieving what i am after
as e.Item.DataItem.Item(3) doesn't appear to be returning a dbnull if it
is empty.
It appears to be returning an empty string.

Adam..

Nov 19 '05 #3
Yes that works just fine. Anything like "" or String.Empty or Nothing
would work.

-Darren Kopp

Nov 19 '05 #4

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

Similar topics

2
by: Andreas Palm | last post by:
I have a dataset that has DBNull in certain columns, now when I write out this one to XML, I only get the columns as elements that do have data in it. However I do need also the empty colums as...
11
by: Dan Bass | last post by:
which one do you use and why? MyString == null || MyString == "" vs MyString == null || MyString.Length == 0
14
by: cj | last post by:
What is string.empty used for? I can't say: if string.empty then I have to use: if string = "" then which is ok, I just want to know what .empty is for.
26
by: Neville Lang | last post by:
Hi all, I am having a memory blank at the moment. I have been writing in C# for a number of years and now need to do something in VB.NET, so forgive me such a primitive question. In C#, I...
26
by: anonieko | last post by:
In the past I always used "" everywhere for empty string in my code without a problem. Now, do you think I should use String.Empty instead of "" (at all times) ? Let me know your thoughts.
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
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...

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.