How to autocold a list box after adding a new item, but only if the scrollbar is down before the item is added?
This sample code can help you For some time this list has been taken to know about boxes
Obviously, this is just a form with a button and a list box. Modify your needs to fit:
Private Zero Button 1_Click (Object Sender, EventArgs e) {listBox1.Items.Add ("Some Text" + List Box1.Items.Count. ToString ()); // The maximum number of items that can be listed at a time in the list of offsite = listBox1.ClientSize.Highlight / listBox1.ItemHeight; If (listBox1.TopIndex == listBox1.Items.Count - NumberOfItems - 1) {// Items at the top when you can only see the list of items below box1.TopIndex = listBox1.Items.Count - NumberOfItems + 1; }}
Comments
Post a Comment