473,569 Members | 2,762 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Scrolling ListBox contents?

Hello,

I have a simple application in which I am using a ListBox to display text
strings for logging purposes. When the text area becomes full the new lines
are added to the end and the vertical scroll bar becomes visible, however,
it does not automatically scroll up to show the most recent lines. What do
I need to do to get it to scroll all the way up each time a new line is
added, even though I might have previously manually pulled the scroll bar to
another position?

Thanks,
Ray Mitchell
Nov 15 '05 #1
1 6071

I came accross this problem my self. I found that listBox.TopInde x sets
the top line in the listBox. I added a global:
int nbrListBoxItems ;

and in the menu initilization added:
// TODO: Add any constructor code after InitializeCompo nent
//
nbrListBoxItems = testListBox.Cli entSize.Height /
testListBox.Ite mHeight;
this determines the number of lines displayed.

Then when I added an entry I added the code:
if (testListBox.It ems.Count > nbrListBoxItems )
testListBox.Top Index = testListBox.Ite ms.Count - nbrListBoxItems +1;

This works. I have been looking for a way to use a listBox event along
with this code so I don't have to added it after every add. I tried
using SizeChanged, but the code there never changes the listBox. I know
it must be a context thing, but I haven't figured it out yet. Anyone
have an answer?
Bill

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
5241
by: J P Singh | last post by:
Hi There We have dropdown on ASP page. The problem is we have about 900 items in the dropdown. Users scrolling through the list have become very frustrated in the past. Can someone suggest if there is another way of implement a dropdown where the datalist is as big as ours. I am looking for something like a listbox in VB where you can...
4
11254
by: headware | last post by:
I have a <select> control that contains many entries. It allows the user to multi-select a group of them, click a button, and store the selected data in a database. Normally they do this starting at the top of the list moving down towards the bottom. The problem I was having was that the <select> control was scrolling back to the top of the...
1
3599
by: Wesman | last post by:
Threads, textboxes and scrolling Thanks in advance for any information on this matter. I have run into a small richtextbox, scrolling and tread issue. Which has me totally confused. Instead of trying to explain it I wrote some small C# code to demonstrate the fact that in the threaded version the textbox simple doesn't scroll like it...
0
1353
by: Tim Bücker | last post by:
Hello. I have a listview and a listbox. If the listbox gets vertically scrolled, the listview should make the same movement. So I have extended the listbox control: public class ExListBoxScrolling : ListBox protected override void WndProc(ref Message m) {
3
5229
by: Oddball | last post by:
Hello again, I have a problem that I can't seem to find any help for. I'm probably not typing the correct words into goo... *cough*... MSN. I have created a user control which I would like to use as items in a list. The list would display as many of these controls as I wish to add, scrolling as it needs to. I KNOW this functionality...
7
4522
by: Dave | last post by:
Hi all, After unsuccessfully trying to make my own dual listbox control out of arraylists, I decided to look for a 3rd party control. I've looked for over a week now and can't find anything but ASP.Net stuff when I need a Windows Form control. I've seen dual listbox populators in countless Windows applications, and have seen them run very...
0
1186
by: =?Utf-8?B?YW1iZXI=?= | last post by:
Hello! I have a form that contains a tabcontrol, that is populated based on which record a user selects in a listbox on the form. I just added code to 'mytab.validating' so if the user tries to navigate to another record, and they have made changes, they are prompted to save. Here's my problem - when the user clicks another record in the...
0
2670
by: LostInMd | last post by:
Hi All, I've got an owner drawn listBox where I draw and measure the items that I add to the listBox. For example, I have a listBox that can only display 10 characters on each horizontal line. The majority of my items contain much more than 10 characters and thus the reason for my use of owner drawn listBoxes - I do not want to use a...
2
2981
by: C_Kubie | last post by:
I have a populater listbox and I update the contents by running a different SQL statement via listbx.Rowsource ="<SQL statement>" The contents of the listbox changes but the form doesn't. What sytax or command should I use to update the form fields? thanks,
0
7694
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.