Solved

listbox cannot add item

Posted on 1998-04-13
2
306 Views
Last Modified: 2008-02-26
mylistbox give an error 381 whenever i try to add items to the list property in
a subroutine.
eg, private sub Additem()
dim i as integer
for i =0  to 19
listbox.list(i) = array(i)
next
end sub      
can i do the above?
if not , what should i do?
0
Comment
Question by:deuter
2 Comments
 

Accepted Solution

by:
tapsbin earned 50 total points
ID: 1461163
It seems from your question that you have already added items
to your listbox and you want to reassign the elements with the
new values.

(A) If you don't have any element in your listbox then apply
following...

Private Sub AddItem()
    Dim iCnt As Integer
    For iCnt = 0  To 19
    ListBox.AddItem = <Name Of An Array>(iCnt)
Next
End Sub

(B) If you already have the elements and wants to reassign ...

Private Sub AddItem()
    Dim iCnt As Integer

    ListBox.Clear       ' This will clear all the elements
                        ' from your listbox control.
    For iCnt = 0  To 19
    ListBox.AddItem = <Name Of An Array>(iCnt)
Next

If you are not satisfied please tell me more what do you want..
but please do not reopen...i want the points...very eager to
earn the points....

Kind Regards,

TAPS


0
 

Author Comment

by:deuter
ID: 1461164
Taps thanks for your help  it has been very useful.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now