Jump to content
Xtreme .Net Talk

Recommended Posts

  • *Experts*
Posted

In VB.NET, to check if a class is not inialized, use Is Nothing:

 

If myObj Is Nothing Then
 ' Moo
End If

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

  • Leaders
Posted
Try this:
If TXTInput.Text = "" Then
   msgbox "Please enter text !!", msgboxstyle.question, "Error"
End If

Orbity

"These Patriot playoff wins are like Ray Charles songs, Nantucket sunsets, and hot fudge sundaes. Each one is better than the last." - Dan Shaughnessy
  • *Experts*
Posted

Why? Null, Nothing and "" are all different things, and so can't be

interchanged. "" is a string, while Nothing is.... nothing. It's the

lack of anything in the Text object. Stick with "". If you want to do

it a different way, you could use If txtInput.Text.Length = 0 Then. :-\

  • *Experts*
Posted

I know in C# you can use string.Empty (or String.Empty). The fastest method will always be to check the length, VolteFace's last comment.

If txtInput.Text.Length = 0 Then

 

Strings are objects in .NET and contain a header which contains, among other things, the length. It's faster to compare that a known number than to check for "" (or even string.Empty).

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...