Empty string!

  • Thread starter Thread starter Adam Knight
  • Start date Start date
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..
 
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.
 
My solution:

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

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

End If

Is this reasonable??
 
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

Back
Top