473,395 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

ListView and focusing on last item when vertical scrollbars appear

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.
Jun 13 '07 #1
0 1619

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: David Rwj Cherry CS2000 | last post by:
is there any way to disable or lock vertical scroll bars on a browser window? im a newbie and i just don't want them to appear on my screen. sometimes they appear on IE but not on mozilla. any...
0
by: Mathias Soeken | last post by:
Hallo, in a ListView (Details View) the scrollbar appears, if there a more items than space. if you scroll the vertical scrollbar down, you can see the last item in the last col of the ListView....
3
by: ¿ Mahesh Kumar | last post by:
Hi groups,I've placed a listview control and four buttons two navigate inside the list view. Let say . I have written code for <<, >> :)..even for <,> also..but i'm getting error in...
5
by: Frank Rizzo | last post by:
I reload the items in the listview on a regular schedule (i.e. clear the listview, then load it up with fresh values). I want add a convinience to the user whereby my application remembers the...
5
by: Bernie Yaeger | last post by:
I'm using a listview in view 'list' mode, multiselect and dragdrop true. When the listview appears, it has a horizontal scrollbar (if needed) but not vertical scrollbar. How can I get it to...
12
by: J L | last post by:
When I fill a listview, I resize the columns to fit the data. I need to know if the data will fit vertically or if there will be a vertical scroll bar. I need to know this so I can allow for it on...
1
by: malpani.abhijit | last post by:
Hi, I am having a ListView component in my WinForm, when i add some images into it, it gives me a vertical scroll bar. What i want is, the horizontal scrollbar instead of vertical. Is there any...
1
by: Kimmo Laine | last post by:
Hi! I need to resize the last column in my listview control so that there won´t be horizontal scrollbar. Lets first create lv and add some items: listView1.View = View.Details;
1
by: =?Utf-8?B?YW5kaSByaWNrZW5iYWNo?= | last post by:
Hello, i have two listviews next to each other on a form. I would like to synchronize both vertical scrollbars of the two listviews with one scrollbar (for example VScrollBar). How can I do...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.