Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi there, Was wondering if anyone could help ?? I am adding items to a listbox that has
around 10 lines. When i add number 11 i want the list box to move down so it shows
number 11 so i dont have keep using the scroll down. Had a good look around and tried a few ways
but can not find an answer.

Hopefully i have explained this ok find it hard to explain !!!


Thanks in advance ,

Dave.

Sorry my appologies its visual basic 2010 - visual studio 2010 - Windows form

Sorry yet again i am new to programming and very new to this site !!!!! Not even sure what people want me put in tags !!

Using microsoft Networks .Net Version 4.0 - Again sorry for lack of details. Hopefully this is what you have asked me for.

Oh yes and thank you for being so understanding !!
Posted
Updated 22-Jan-11 3:16am
v5
Comments
Sergey Alexandrovich Kryukov 21-Jan-11 15:45pm    
Language, platform? WPF, WinForms, ASP.NET...? (I know the answer, of course, but answer the question. Be sure next time you put all relevant tags.)

By the way 1) your explanation is clear, 2) this is one of the easiest questions from both standpoints: of inquirer and the one who answers, 2) if this is hard to explain, how are you going to get help for essential problems.

I'll up-vote to "3" because your intent is very good: many others don't care about visibility of items at all. :-)
[no name] 21-Jan-11 15:46pm    
It would be help to know what environment you are working in, Windows or Web? Visual-Studio as a tag is not helpful at all.
#realJSOP 22-Jan-11 7:33am    
You STILL haven't specified the language, whether or not you're using .Net, or ANYTHING that can help us help you.

You didn't mention the platform (unmanaged C++ or .Net)

For .Net, set the TopIndex property.

http://msdn.microsoft.com/en-us/library/system.windows.forms.listbox.aspx[^]

For C++/MFC, it's listBox.SetTopIndex().

http://msdn.microsoft.com/en-us/library/k8cseaky(v=vs.80).aspx[^]
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 21-Jan-11 15:52pm    
Please, don't assume the platform/technology, better force inquirers to specify the platform.
I'm asking because a mass of such questions already created a disaster.
Honestly.
--SA
#realJSOP 22-Jan-11 7:31am    
I think I covered the most widely used ones. Almost nobody does WPF...
Sergey Alexandrovich Kryukov 25-Jan-11 12:19pm    
Nobody does WPF? Is so, this is a sad fact.
Well, then you covered most widely uses indeed, who would argue against that.

As to situation with WPF, it may change with time, let's see.
#realJSOP 25-Jan-11 12:27pm    
I said *almost* nobody.
Sergey Alexandrovich Kryukov 25-Jan-11 12:37pm    
Yes, I noticed that. I like accuracy. That's why I expressed my agreement; otherwise I would say you were lying :-)
Thank you.
Respect,
--SA
Have you tried the Listbox.ScrollIntoView()[^] method?

You do not say which language you are using, so I have assumed C# and WindowsForms.

Your tag 'Visual-Studio' imparts no useful information.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 21-Jan-11 15:50pm    
Please, don't assume, better force inquirers to specify the platform.
I'm asking because a mass of such questions already created a disaster.
#realJSOP 22-Jan-11 7:32am    
I think you can afford to back off on the guidance. We've all been here quite a while and know the dangers of answering questions.
Sergey Alexandrovich Kryukov 25-Jan-11 12:16pm    
John, with all my respect, you're way too sensitive. I think it's second time you blame on my comment just out of annoyance. My comment does not question your competence. It does not matter who spend what time in what activity, not at all -- you should admit it. This is my opinion: "force inquirers to specify the platform", no comment needed to assume this is just my opinion. If you feel uncomfortable even about this comment, you need more internal freedom.

We're doing together not bad, and I deeply respect your expertise, thinking and opinions; no reason to spoil it.

Best,
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900