AW: [pro_vb] Array problem
A possible way is to dim a boolean like that
Dim bolListSelect as boolean
Dim i As Long, ctr As Long
ctr = 0
For i = 1 To lvcons.ListItems.Count
If lvcons.ListItems(i).Checked = True Then
ReDim Preserve arrTmpIDs(ctr)
arrTmpIDs(ctr) = lvcons.ListItems(i).Text
ctr = ctr + 1
bolListSelect = true
End If
Next
Now you have got a True or false
cheers Kilian
-----Ursprüngliche Nachricht-----
Von: Satyajeet Hattangadi [mailto:satyajh@m...]
Gesendet: Montag, 23. Dezember 2002 09:47
An: professional vb
Betreff: [pro_vb] Array problem
Wichtigkeit: Hoch
Hi,
This is really a no brainer.. and im brain dead at the moment. :o)
I have treeview with check boxes.The user check boxes the wants, and then
click an ok button.When he does this i loop through the nodes and add the
item to an array.
Since i dont know in advance how many checkboxes the user will select, im
using a dynamic array.
which im setting using a counter in the loop and redimming it again.
Dim i As Long, ctr As Long
ctr = 0
For i = 1 To lvcons.ListItems.Count
If lvcons.ListItems(i).Checked = True Then
ReDim Preserve arrTmpIDs(ctr)
arrTmpIDs(ctr) = lvcons.ListItems(i).Text
ctr = ctr + 1
End If
Next
Now the probelm is if the user doesnt select any checkbox, my ubound call at
the next form bombs.
What i need is a way to findout if the array is undimensioned.. any function
to do that or a workaround??
Thanks
Satya
*********************************************************
Disclaimer
This message (including any attachments) contains
confidential information intended for a specific
individual and purpose, and is protected by law.
If you are not the intended recipient, you should
delete this message and are hereby notified that
any disclosure, copying, or distribution of this
message, or the taking of any action based on it,
is strictly prohibited.
*********************************************************
Visit us at http://www.mahindrabt.com