Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show scrollbars when the control's content overlaps its visible boundaries

I am working with List Box control in Vb.net , The problem is, I am populating List Box from a Slider control's values, At times, values reach out of its visible rectangle area. I want to see the updated values during slider move,I have added both the events

_SelectedIndexChanged
_SelectedValueChanged

but they both not triggering when I add values to List Box using Slider Control.

My tentative code for showing the latest value is this, but I am not getting where to type.

{
    Dim count As Integer
    count = lb.Items.Count     ' lb is the ListBox's variable
    lb.SetSelected(count - 1, True) 
}
like image 452
DareDevil Avatar asked Nov 20 '25 15:11

DareDevil


1 Answers

Depending on whether you want to just scroll to the bottom or select the last one:

lb.SelectedIndex =lb.SelectedIndex + 1

or to scroll it:

lb.TopIndex = lb.Items.Count - 1

add it after your code to add items. The latter is generally better because it doesnt change what the user might have selected already.

like image 187
Ňɏssa Pøngjǣrdenlarp Avatar answered Nov 22 '25 04:11

Ňɏssa Pøngjǣrdenlarp



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!