Hi,
I was wondering if anyone can help me with this. I have a listview that is specified to a size of:
348W x 308H
When items are added to it, no problems. However when items continue to be added such that the list gets too large to be displayed, the scrollbars appear. Once this occurs, the last item though selected and focused (highlighted blue), will not appear within the viewable area since the listview requires a scrolldown.
This listview has 4 columns:
-name, quantity, price, subtotal
I add the subitems to a temporary listview object which in turn is added to my listviewReceipt. Once added, I set focus to the listviewReceipt and select the last item added. Here is a bit of the code snippet:
.....
sTemp = String.Format("{0:n2}", dTempTotal) 'added to subtotal
lvObject.SubItems.Add(sTemp)
lvReceipt.Items.Add(lvObject)
lvReceipt.Focus()
lvReceipt.Items(lvObject.Index).Selected = True
My question is how to make the listview automatically scrolldown to the last item added. I was able to do this with a regular listbox using the following two lines of code:
lstReceipt.Items.Add(oGroceryItem)
lstReceipt.SelectedIndex = lstReceipt.Items.Count - 1 'sets focus and autoscrolls down if neccessary
however the listbox formatting is not very nice for a 4 column list. Any help would be greatly appreciated.
Thanks ahead of time.