|
|
|
|
![]() ![]() |
Mar 6 2005, 03:27 PM
Post
#1
|
|
|
Premium Member 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 |
|
|
|
Mar 6 2005, 03:44 PM
Post
#2
|
|
|
S.P.A.M.S.W.A.T. 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...
|
|
|
|
Mar 7 2005, 09:44 PM
Post
#3
|
|
|
Newbie [ Level 2 ] 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!" |
|
|
|
Mar 27 2005, 01:07 PM
Post
#4
|
|
|
Pretty please? 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" |
|
|
|
Mar 28 2005, 06:28 PM
Post
#5
|
|
|
Techno-Necromancer 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" |
|
|
|
Mar 31 2005, 12:45 PM
Post
#6
|
|
|
Premium Member 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. |
|
|
|
Apr 25 2005, 08:32 PM
Post
#7
|
|
|
Super Member 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 |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 5th December 2008 - 02:27 PM |