Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old November 23rd, 2004, 08:47 AM
P9drm1 P9drm1 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 5 P9drm1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 28 m 54 sec
Reputation Power: 0
Question Listbox question

When I add items to a listbox and the listox fills up with items a scrollbar appears on the
right side of the listbox so that I can scroll down the list to see the Items that
do not appear. My question for the forum, is there a way for the Listbox
to always display the last items that were added to the listbox. I would like for my listbox
to scroll down automatically when a new item is added.

Thanks,
Darryl

Reply With Quote
  #2  
Old November 23rd, 2004, 09:38 PM
Leslie's Avatar
Leslie Leslie is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Honolulu
Posts: 184 Leslie User rank is Corporal (100 - 500 Reputation Level)Leslie User rank is Corporal (100 - 500 Reputation Level)Leslie User rank is Corporal (100 - 500 Reputation Level)Leslie User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 20 h 29 m 2 sec
Reputation Power: 8
Quote:
Originally Posted by P9drm1
When I add items to a listbox and the listox fills up with items a scrollbar appears on the
right side of the listbox so that I can scroll down the list to see the Items that
do not appear. My question for the forum, is there a way for the Listbox
to always display the last items that were added to the listbox. I would like for my listbox
to scroll down automatically when a new item is added.

Thanks,
Darryl
You are being a bit vauge, so without knowing how items are getting added to the list, if you have a sort order on the list, if you are loading the list from a database, all I can tell you is that this:

"Me.ListBox1.SelectedIndex = Me.ListBox1.Items.Count - 1"

on the form load event will open the form and advance the list to the last item in the list. For better list management, you could create a table in a database which holds the values and controls how the items should appear in the list. For instance, adding a timestamp field to the record, you could use the timestamp to deterimine if an item is "new" to the list or not.




Reply With Quote
  #3  
Old November 27th, 2004, 10:07 AM
Journeyman Journeyman is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 20 Journeyman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 19 m 18 sec
Reputation Power: 0
List box

I have had the same problem, the way I went about it was like this: Since I was pulling my data from a database table I moved the pointer to the last item in the table, then wrote a Do While Not BOF (begining of file) loop to populate the combo box (I used a combo box instead of a list box)

Sample code:


Private Sub GetTrks()
'This Sub routine gets the truck number from field Turck_Numb of Table
'Truck_List in the TruckingUSA database and loades it to the combo box trucks.

On Error GoTo Quit

Set rsMyDbWindow = dbTrucking.OpenRecordset("Truck_List", dbOpenDynaset) 'Name of Table
rsMyDbWindow.MoveLast

'This is a loop to populate the combo box
Do While Not rsMyDbWindow.BOF
cboTrucks.AddItem rsMyDbWindow!Truck_Numb
cboWTrkNo.AddItem rsMyDbWindow!Truck_Numb
cboHistTrks.AddItem rsMyDbWindow!Truck_Numb
rsMyDbWindow.MovePrevious
Loop
Quit:
End Sub

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Listbox question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway