471,350 Members | 1,922 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

Scroll problem in listbox

Hi,

I'm currently working on a simple project (for study on C#) with an
input (maskedtextbox) and a listbox. The input numbers are send in the
listbox.
When the listbox is filled with numbers it automaticly puts the
scrollbar in the listbox, thats fine but it doesn't scroll down to the
last number that was keyed in and isn't visible. You have to scroll
down in the listbox itself to make the last number that was entered
visible.
What is needed to make the listbox scroll down automaticly to see the
last number inputted?

TIA,
John
Dec 14 '05 #1
2 8798
Well, I am not an expert, and my solution may look rather crude to some
people, but it works. It is the same idea for what I have to use with C++
and listboxes.
Put this statement (with the name of your list box of course) at the end of
every function that prints text to a list box.
In C#:
myListBox.SelectedIndex = myListBox.Items.Count - 1;

In C++:
m_myListBox.SetCurSel(m_myListBox.GetCount() - 1);

Hey, if anyone has a better way, I would love to know as well. :-}

Hope this helps.

Rob K
"John @hotmaill.com>" wrote:
Hi,

I'm currently working on a simple project (for study on C#) with an
input (maskedtextbox) and a listbox. The input numbers are send in the
listbox.
When the listbox is filled with numbers it automaticly puts the
scrollbar in the listbox, thats fine but it doesn't scroll down to the
last number that was keyed in and isn't visible. You have to scroll
down in the listbox itself to make the last number that was entered
visible.
What is needed to make the listbox scroll down automaticly to see the
last number inputted?

TIA,
John

Dec 14 '05 #2
Well Rob.
Maybe there are other (better) ways, but your (C# solution)
worked the way I wanted and is good enough.
tnx for the input.

John

On Wed, 14 Dec 2005 13:36:40 -0800, "RobKinney1"
<Ro********@discussions.microsoft.com> wrote:
Well, I am not an expert, and my solution may look rather crude to some
people, but it works. It is the same idea for what I have to use with C++
and listboxes.
Put this statement (with the name of your list box of course) at the end of
every function that prints text to a list box.
In C#:
myListBox.SelectedIndex = myListBox.Items.Count - 1;

In C++:
m_myListBox.SetCurSel(m_myListBox.GetCount() - 1);

Hey, if anyone has a better way, I would love to know as well. :-}

Hope this helps.

Rob K
"John @hotmaill.com>" wrote:
Hi,

I'm currently working on a simple project (for study on C#) with an
input (maskedtextbox) and a listbox. The input numbers are send in the
listbox.
When the listbox is filled with numbers it automaticly puts the
scrollbar in the listbox, thats fine but it doesn't scroll down to the
last number that was keyed in and isn't visible. You have to scroll
down in the listbox itself to make the last number that was entered
visible.
What is needed to make the listbox scroll down automaticly to see the
last number inputted?

TIA,
John


Dec 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Keltus | last post: by
6 posts views Thread by Adam Klobukowski | last post: by
2 posts views Thread by Tina | last post: by
7 posts views Thread by Lit | last post: by
reply views Thread by XIAOLAOHU | last post: by

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.