Solved

listbox cannot add item

Posted on 1998-04-13
2
318 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no 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…

751 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