[1.0/1.1] Listbox focus always on the last line/item added? [C# 2002]
This is going to be fun to explain...
I am using the LISTBOX (lbOutput) as a way to output information to the user (via the lbOutput.items.add(sInfo);) - when the listbox itself gets full the scrollbars appear except that the focus remains at the top of the listbox.
As lines keep getting added the user has to scroll DOWN to see the information. I need the opposite, I need to ensure the Listbox will always show the LAST ITEM ADDED at all times, if the user wants to see what happened before he can easily scroll up using the scroll bars. Kind of like how the command prompt works.
I went through the ListBox properties and was unable to find anything to that effect - any ideas?
Any help would be greatly appreciated...
Thanks,
Re: [1.0/1.1] Listbox focus always on the last line/item added? [C# 2002]
Are you sure that a ListBox is the appropriate control for that. It sounds like a TextBox may be a better option, perhaps with its ReadOnly property set to True. Then you just call AppendText and the new string will be added to the end and the caret set at the end of the text.
If you do stick with a ListBox I believe this should have the desired effect:
C# Code:
this.ListBox1.TopIndex = this.ListBox1.Items.Count - 1;