ListBox should be moved automatically?

Herry Markowitz

Well-known member
Joined
Oct 22, 2015
Messages
46
Programming Experience
1-3
Hi experts,
ListBox should be moved automatically...
In order to understand my question please look at this picture.

sorulacak 20sinde.png

Thanks in advance.
 
Last edited:
I can't speak for everyone else but if I'm going to help someone, I expect an explanation of their issue and any supporting images attached to the post, not a link and no other information.
 
Hi jmcilhinney,
I have deleted the link and add a picture to first thread.
Any support now?
 
Hi jmcilhinney,
I have deleted the link and add a picture to first thread.
Any support now?

A picture may be worth a thousand words but that doesn't mean that you shouldn't include some words. If what you want is that, when you add an item to a ListBox, that the ListBox scrolls to make that item visible then that is what you should say.
 
Hi there,
I have written following code but it doesnt work. Any idea?

Please note that there is no selection item in my project!

VB.NET:
        ListBox1.Items.Add("1-Starting...")        
        ListBox1.Items.Add("2-Task1 completed...")
        ListBox1.Items.Add("3-Task2 completed...")
        ListBox1.Items.Add("4-Task3 completed...")
        ListBox1.Items.Add("5-Task4 completed...")
        ListBox1.Items.Add("6-Task5 completed...")
        ListBox1.Items.Add("7-Task6 completed...")
        ListBox1.Items.Add("8-Task7 completed...")
        ListBox1.Items.Add("9-Task8 completed...")
        ListBox1.Items.Add("10-Task9 completed...")
        ListBox1.Items.Add("11-Task10 completed...")
        ListBox1.Items.Add("12-Finished...")


        ' Determine if the currently selected item in the ListBox 
        ' is the item displayed at the top in the ListBox.
        If ListBox1.TopIndex <> ListBox1.Items.Count.ToString() Then
            ListBox1.TopIndex = ListBox1.Items.Count.ToString()
        End If


        ' Remove all items before the top item in the ListBox.
        Dim x As Integer
        For x = ListBox1.Items.Count.ToString() - 1 To 0 Step -1
            ListBox1.Items.RemoveAt(x)
        Next x


        ' Clear all selections in the ListBox.
        ListBox1.ClearSelected()
 
A picture may be worth a thousand words but that doesn't mean that you shouldn't include some words. If what you want is that, when you add an item to a ListBox, that the ListBox scrolls to make that item visible then that is what you should say.

Hi jmcilhinney,
My native language is not English so I am not able to explain my needs clearly...
That is why I prefer to post picture...
Sorry about that...
 
All the English you've posted in this thread so far is perfectly fine. Better than some native speakers I would say. Again, I can't speak for everyone but, as far as I'm concerned, a written description of the problem is a must and things like screenshots should be for additional clarification only. I've seen far too many cases where people think their images are meaningful but they are gibberish to someone with no previous knowledge of their project.
 
This is exactly what I want.
After every time something is added to the listbox you should have this line:
ListBox1.TopIndex = ListBox1.Items.Count - 1

You could make your own sub that accepts the new string to be put in the listbox and that will not only add the new item, but you can have that line of code ran too. That way you dont have to keep track of making sure it's put in after every .Items.Add() call.
 
Back
Top