Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> [visual Basic] How To Confirm A Array Is Null
jedipi
post Mar 6 2005, 03:27 PM
Post #1


Premium Member
Group Icon

Group: Members
Posts: 352
Joined: 2-March 05
From: Australia
Member No.: 2,859



for example,

Dim array() as integer

during run time, how to confirm a array is null (do not contain any element)
Thanks
Go to the top of the page
 
+Quote Post
szupie
post Mar 6 2005, 03:44 PM
Post #2


S.P.A.M.S.W.A.T.
Group Icon

Group: Members
Posts: 814
Joined: 22-January 05
From: San Antonio, Texas (No, I'm not dumb. I just moved here...)
Member No.: 2,284



Uh... Are you asking a question or is this like a tutorial? If it is a question, please use the "How do I confirm" or "How is an array confirmed" form, or simply add a question mark. I'm not trying to mock you...
Go to the top of the page
 
+Quote Post
BabyTux
post Mar 7 2005, 09:44 PM
Post #3


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 21
Joined: 2-March 05
From: Auckland, New Zealand
Member No.: 2,849



CODE
on error goto w
Dim a() As Integer
Dim i As Integer
i = UBound(a)    'If a() contains no element an error will occur
exit sub
w:
   msgbox "Array is empty!"
Go to the top of the page
 
+Quote Post
jipman
post Mar 27 2005, 01:07 PM
Post #4


Pretty please?
Group Icon

Group: Members
Posts: 733
Joined: 28-November 04
From: Holland
Member No.: 1,552



Euh... how about this:

dim a() as integer
if lbound(a) = ubound(a) and lbound(0) = 0 then msgbox "aray is empty"
Go to the top of the page
 
+Quote Post
vizskywalker
post Mar 28 2005, 06:28 PM
Post #5


Techno-Necromancer
Group Icon

Group: Members
Posts: 1,018
Joined: 13-January 05
From: The Net
Member No.: 2,127



If the array is completely empty and thus null, you could just use the IsNull function, like so or IsEmpty():
If Isnull(array) then msgbox "array is empty"
or
If IsEmpty(array) then msgbox "array is empty"

Go to the top of the page
 
+Quote Post
jedipi
post Mar 31 2005, 12:45 PM
Post #6


Premium Member
Group Icon

Group: Members
Posts: 352
Joined: 2-March 05
From: Australia
Member No.: 2,859



QUOTE(vizskywalker @ Mar 29 2005, 05:28 AM)
If the array is completely empty and thus null, you could just use the IsNull function, like so or IsEmpty():
If Isnull(array) then msgbox "array is empty"
or
If IsEmpty(array) then msgbox "array is empty"
*



Thanks for your help.

yes..I just use IsEmpty() function to get the task done.
Go to the top of the page
 
+Quote Post
tansqrx
post Apr 25 2005, 08:32 PM
Post #7


Super Member
Group Icon

Group: [HOSTED]
Posts: 557
Joined: 25-April 05
Member No.: 4,374
myCENTs:17.04



Didn't really see if you were talking VB 6 or .NET. In .NET you can use the "Nothing" keyword.

Dim array() As Integer

If array Is Nothing Then
'do something
End If
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Visual Basic Help(7)
  2. Visual Basic: Replace Explained!(4)
  3. Visual Basic: Unload Your Application Correctly!(1)
  4. Visual Basic: Change Your Start Button Text! (XP)(16)
  5. Visual Basic: Random Strings!(10)
  6. Visual Basic 6 + Crystal Reports 9(6)
  7. Visual Basic Names(11)
  8. New Features In Visual Studio 2005 Windows Forms(1)
  9. Visual Basic.NET Help Needed.(8)
  10. Is There A Free IDE For VB.NET Programming?(4)
  11. Visual Basic Express Tutorials(5)
  12. [help] Visual Studio .net 2005 Questions(8)
  13. Installed Internet Explorer 7?, Visual Basic Now Broken?(3)
  14. Visual Basic Projects: Scoreboard(0)
  15. Delete A Registry Subkey And Key(8)
  1. Necklace Problem In Visual Basic(3)


 



- Lo-Fi Version Time is now: 5th December 2008 - 02:27 PM