473,626 Members | 3,093 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ListView and focusing on last item when vertical scrollbars appear

1 New Member
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.SubIte ms.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.Item s.Add(oGroceryI tem)
lstReceipt.Sele ctedIndex = lstReceipt.Item s.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 1655

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

Similar topics

3
16526
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 ideas would be most appreciated.
0
1309
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. is there a chance to have more extra space after the last item? thanks Mathias
3
5546
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 condition. I mean, if my selected item is the last one, but still if i press >, it should be at the last item only.
5
22489
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 position of the scrollbars after reloading the data. But I can’t figure out how to retrieve the scrollbar position (both horizontal and vertical). Neither can I figure out how to restore the state of the scrollbars. I could theoretically figure...
5
6420
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 display a vertical scrollbar? Thanks for any help. Bernie Yaeger
12
7472
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 the overall size of the listview. My question therefore is, how can I tell if the items I have added will fit in the listview at its given height? A secondary one, just for interest sake...is there a way to determine the exact heght needed...
1
9304
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 way to hide the vertical scrollbars and display horizontal scrollbars?
1
3546
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
4988
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 that? Thank you very much.
0
8259
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8192
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8696
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8637
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7188
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6119
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4195
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2621
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.