Empty string!

A

Adam Knight

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..
 
L

Lucas Tam

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.
 
A

Adam Knight

My solution:

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

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

End If

Is this reasonable??
 
D

Darren Kopp

Yes that works just fine. Anything like "" or String.Empty or Nothing
would work.

-Darren Kopp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,265
Messages
2,571,071
Members
48,771
Latest member
ElysaD

Latest Threads

Top