Listbox refresh

  • Thread starter =?iso-8859-1?Q?R=E9mi_Lavoie?=
  • Start date
?

=?iso-8859-1?Q?R=E9mi_Lavoie?=

Hi,

I'm adding items in a listbox automatically. When my
listbox is full, the scrollbar appears but i can't set my
listbox to see the new items. I would like that my
scrollbar follow the new item (it goes down
automatically).

Which event i need to use? Which property i need to set?

Thanks
 
O

One Handed Man [ OHM# ]

This will select the last item and make it visible.

ListBox1.SelectedIndex = ListBox1.Items.Count - 1

Regards - OHM


Rémi Lavoie said:
Hi,

I'm adding items in a listbox automatically. When my
listbox is full, the scrollbar appears but i can't set my
listbox to see the new items. I would like that my
scrollbar follow the new item (it goes down
automatically).

Which event i need to use? Which property i need to set?

Thanks

Regards - OHM# OneHandedMan{at}BTInternet{dot}com
 
A

Armin Zingler

Rémi Lavoie said:
I'm adding items in a listbox automatically. When my
listbox is full, the scrollbar appears but i can't set my
listbox to see the new items. I would like that my
scrollbar follow the new item (it goes down
automatically).

Which event i need to use? Which property i need to set?

Set the SelectedIndex property. The Add function returns the new index.
 
J

Jared

-- or --
Dim lvi As New ListViewItem(Me.txtAdd.Text.TrimEnd)

Me.ListView1.Items.Add(lvi)

Me.ListView1.EnsureVisible(Me.ListView1.Items.Count - 1)

EnsureVisable does the same thing it just doesn't select it
 
O

One Handed Man [ OHM# ]

Jared the OP refer's to a ListBox, not a ListView. Come on now, wake up !
;-)

Regards - OHM

-- or --
Dim lvi As New ListViewItem(Me.txtAdd.Text.TrimEnd)

Me.ListView1.Items.Add(lvi)

Me.ListView1.EnsureVisible(Me.ListView1.Items.Count - 1)

EnsureVisable does the same thing it just doesn't select it

Regards - OHM# OneHandedMan{at}BTInternet{dot}com
 
J

Jared

Sorry early in the morning for me, I'm only hanging around here waiting for
my own post to be recognized. I posted about NetMessageBufferSend. Feel free
to give me a HAND. Bad humor is due to lack of coffee.
Jared
 
H

Herfried K. Wagner [MVP]

* Rémi Lavoie said:
I'm adding items in a listbox automatically. When my
listbox is full, the scrollbar appears but i can't set my
listbox to see the new items. I would like that my
scrollbar follow the new item (it goes down
automatically).

Which event i need to use? Which property i need to set?

\\\
Me.ListBox1.SelectedIndex = Me.ListBox1.Items.Add("Foo")
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top