PC Review


Reply
Thread Tools Rate Thread

ListBox using RemoveItem

 
 
=?Utf-8?B?R3VzIENodWNo?=
Guest
Posts: n/a
 
      17th Mar 2006
I’m having trouble using the RemoveItem on my ListBox, does anyone know a
better way?
I’m using a ListBox to display the results of a loan program. This sets up
the header
lstResult.ColumCount = 4
lstResult.ColumnHeads = True
lstResult.ColumnWidths = “.5in;1in;1in;1in”
lstResult.AddItem “Mo;Interest;Principal;Balance”

This Adds Items to the ListBox and it work fine

FOR X=1 to Y
lstResult.AddItem (MonthNumber & “;” & MonthlyInterest & “;” & PrincipalPaid
& “;” & RemainigBalance)
NEXT

Now I need to clear the ListBox to run the program again
So using ListIndex and RemoveItem I try to clear the ListBox but
All combination that I have tried so far leaves the last row in the header
row.
Is their some way of deleting all the Items?

--
thank You
 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      17th Mar 2006
I believe the number of rows in Listboxes starts at 0, not 1.

However, if you're trying to remove all rows, it's simpler strictly to reset
the control's RowSource to a zero-length string:

lstResult.RowSource = ""

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Gus Chuch" <(E-Mail Removed)> wrote in message
news:0260A658-6CDF-461D-8E2E-(E-Mail Removed)...
> I'm having trouble using the RemoveItem on my ListBox, does anyone know a
> better way?
> I'm using a ListBox to display the results of a loan program. This sets up
> the header
> lstResult.ColumCount = 4
> lstResult.ColumnHeads = True
> lstResult.ColumnWidths = ".5in;1in;1in;1in"
> lstResult.AddItem "Mo;Interest;Principal;Balance"
>
> This Adds Items to the ListBox and it work fine
>
> FOR X=1 to Y
> lstResult.AddItem (MonthNumber & ";" & MonthlyInterest & ";" &
> PrincipalPaid
> & ";" & RemainigBalance)
> NEXT
>
> Now I need to clear the ListBox to run the program again
> So using ListIndex and RemoveItem I try to clear the ListBox but
> All combination that I have tried so far leaves the last row in the header
> row.
> Is their some way of deleting all the Items?
>
> --
> thank You



 
Reply With Quote
 
=?Utf-8?B?R3VzIENodWNo?=
Guest
Posts: n/a
 
      17th Mar 2006
that it, it works
I was thinking about using the RowSource
--
thank You


"Douglas J. Steele" wrote:

> I believe the number of rows in Listboxes starts at 0, not 1.
>
> However, if you're trying to remove all rows, it's simpler strictly to reset
> the control's RowSource to a zero-length string:
>
> lstResult.RowSource = ""
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no private e-mails, please)
>
>
> "Gus Chuch" <(E-Mail Removed)> wrote in message
> news:0260A658-6CDF-461D-8E2E-(E-Mail Removed)...
> > I'm having trouble using the RemoveItem on my ListBox, does anyone know a
> > better way?
> > I'm using a ListBox to display the results of a loan program. This sets up
> > the header
> > lstResult.ColumCount = 4
> > lstResult.ColumnHeads = True
> > lstResult.ColumnWidths = ".5in;1in;1in;1in"
> > lstResult.AddItem "Mo;Interest;Principal;Balance"
> >
> > This Adds Items to the ListBox and it work fine
> >
> > FOR X=1 to Y
> > lstResult.AddItem (MonthNumber & ";" & MonthlyInterest & ";" &
> > PrincipalPaid
> > & ";" & RemainigBalance)
> > NEXT
> >
> > Now I need to clear the ListBox to run the program again
> > So using ListIndex and RemoveItem I try to clear the ListBox but
> > All combination that I have tried so far leaves the last row in the header
> > row.
> > Is their some way of deleting all the Items?
> >
> > --
> > thank You

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Listbox RemoveItem Raymond Clarke Jr Microsoft Access Form Coding 1 13th May 2009 07:52 PM
removeitem in listbox =?Utf-8?B?RGF2ZQ==?= Microsoft Access 2 5th Apr 2007 11:38 PM
Listbox .additem / .removeitem ? kelly draper via AccessMonster.com Microsoft Access Form Coding 4 4th Jun 2005 01:40 AM
ACC2002 - RemoveItem from MultiSelect ListBox Tony_VBACoder Microsoft Access Form Coding 1 19th May 2004 07:05 PM
cannot locate removeItem method on ListBox object in Access 2000 Garry Microsoft Access Form Coding 3 5th Nov 2003 12:04 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:12 PM.