Listbox refresh

  • Thread starter Thread starter =?iso-8859-1?Q?R=E9mi_Lavoie?=
  • Start date 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
 
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
 
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.
 
-- 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
 
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
 
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
 
* 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")
///
 
Back
Top