473,383 Members | 1,876 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,383 software developers and data experts.

listview - determining nbr of visible rows

Is there a way in vb.net to determine the number of rows that can be
visible in the listview region ? Not the total # rows in the
listview, but only the visible count.

Also, I was wondering if there was a way to determine from a given
ListViewItem, whether or not it is currently visible in the region.

Thanks,
Mark
Nov 21 '05 #1
7 7187
For each item, you can retreive the Bounds, this will return the item's
rectangle, you then need to compare this with the client area to see if it
is visible.

HTH

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

<tx***********@yahoo.com> wrote in message
news:lc********************************@4ax.com...
Is there a way in vb.net to determine the number of rows that can be
visible in the listview region ? Not the total # rows in the
listview, but only the visible count.

Also, I was wondering if there was a way to determine from a given
ListViewItem, whether or not it is currently visible in the region.

Thanks,
Mark

Nov 21 '05 #2
There is the EnsureVisible method (this will scroll a listitem into view,
but not tell you if it was visible to begin with).

Greg

<tx***********@yahoo.com> wrote in message
news:lc********************************@4ax.com...
Is there a way in vb.net to determine the number of rows that can be
visible in the listview region ? Not the total # rows in the
listview, but only the visible count.

Also, I was wondering if there was a way to determine from a given
ListViewItem, whether or not it is currently visible in the region.

Thanks,
Mark

Nov 21 '05 #3

<tx***********@yahoo.com> wrote in message
news:lc********************************@4ax.com...
Is there a way in vb.net to determine the number of rows that can be
visible in the listview region ? Not the total # rows in the
listview, but only the visible count.

Also, I was wondering if there was a way to determine from a given
ListViewItem, whether or not it is currently visible in the region.


Public Const LVM_FIRST As Integer = &H1000
Public Const LVM_GETCOUNTPERPAGE As Integer = LVM_FIRST + 40
Public Const WM_SETREDRAW As Integer = &HB
Public Enum LVS_EX
LVS_EX_GRIDLINES = &H1
LVS_EX_SUBITEMIMAGES = &H2
LVS_EX_CHECKBOXES = &H4
LVS_EX_TRACKSELECT = &H8
LVS_EX_HEADERDRAGDROP = &H10
LVS_EX_FULLROWSELECT = &H20
LVS_EX_ONECLICKACTIVATE = &H40
LVS_EX_TWOCLICKACTIVATE = &H80
LVS_EX_FLATSB = &H100
LVS_EX_REGIONAL = &H200
LVS_EX_INFOTIP = &H400
LVS_EX_UNDERLINEHOT = &H800
LVS_EX_UNDERLINECOLD = &H1000
LVS_EX_MULTIWORKAREAS = &H2000
LVS_EX_LABELTIP = &H4000
LVS_EX_BORDERSELECT = &H8000
LVS_EX_DOUBLEBUFFER = &H10000
LVS_EX_HIDELABELS = &H20000
LVS_EX_SINGLEROW = &H40000
LVS_EX_SNAPTOGRID = &H80000
LVS_EX_SIMPLESELECT = &H100000
End Enum 'LVS_EX

Public Enum LVM
LVM_FIRST = &H1000
LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54
LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55
End Enum 'LVM
Public Overloads Declare Auto Function SendMessage Lib "User32.dll"
(ByVal hwnd As IntPtr, ByVal msg As Integer, ByVal wParam As Integer, ByVal
lParam As Integer) As Integer
Private Function GetVisibleItemsCount(ByRef listView As ListView) As
Integer

Dim visibleCount As Integer = SendMessage(listView.Handle,
LVM_GETCOUNTPERPAGE, 0, 0)

Return (visibleCount)

End Function


Bartol
--
Remove "TB" from address to reply
Nov 21 '05 #4
Dim li As ListViewItem

li = ListView1.Items(Convert.ToInt32(textbox1.text))

Debug.WriteLine(li.Bounds.ToString)
Debug.WriteLine(ListView1.ClientRectangle)

If (li.Bounds.Y + (li.Bounds.Height / 2)) <
ListView1.ClientRectangle.Height Then
'This is visible
Debug.WriteLine("Yes")
Else
Debug.WriteLine("No")
End If
// If you want the number of visible items, then simply take the hight of
the controls bounds and do a a modulo division using the item hight as the
denominator.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

<tx***********@yahoo.com> wrote in message
news:lc********************************@4ax.com...
Is there a way in vb.net to determine the number of rows that can be
visible in the listview region ? Not the total # rows in the
listview, but only the visible count.

Also, I was wondering if there was a way to determine from a given
ListViewItem, whether or not it is currently visible in the region.

Thanks,
Mark

Nov 21 '05 #5
Hi Terry,

Did you see it, Herfried is trying to break the old record in this newsgroup
from Nak and Fergus to get the longest thread.

(Although Herfried was as well involved in that previous with a lot of
messages of course)

(Nothing wrong Herfried, I just have fun about it, feel free to do what you
want)

:-)

Cor
Nov 21 '05 #6
What was the subject topic for this thread your talking about ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:uk**************@TK2MSFTNGP14.phx.gbl...
Hi Terry,

Did you see it, Herfried is trying to break the old record in this newsgroup from Nak and Fergus to get the longest thread.

(Although Herfried was as well involved in that previous with a lot of
messages of course)

(Nothing wrong Herfried, I just have fun about it, feel free to do what you want)

:-)

Cor

Nov 21 '05 #7


Terry,

No Equals on interfaces

However it is just to tickle Herfried a little bit.

And I am sure for myself that he opens every message with OT in this
newsgroup.

:-)

Cor



"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> schreef in
bericht news:et**************@TK2MSFTNGP11.phx.gbl...
What was the subject topic for this thread your talking about ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:uk**************@TK2MSFTNGP14.phx.gbl...
Hi Terry,

Did you see it, Herfried is trying to break the old record in this

newsgroup
from Nak and Fergus to get the longest thread.

(Although Herfried was as well involved in that previous with a lot of
messages of course)

(Nothing wrong Herfried, I just have fun about it, feel free to do what

you
want)

:-)

Cor


Nov 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Daisy | last post by:
I'm writing a NewsReader (seemed like a decent project to start learning with), and want threading like in OE. I've got a treeview and a listview. On Expand/Contract on the listview, I spin...
5
by: Phill | last post by:
I've got a Listview control (Detail mode) that I'm adding rows to on another thread from a DB query. The result is about 32,000 rows ans takes a while to finish. I'm adding the rows like this...
2
by: Adam Klobukowski | last post by:
Hello i need to find out the last fully visible item of a Llistview. If it would be a treeview then it would be easy, I'm even thinkin of faking my treeview as listview, but maybe there is some...
10
by: Henry | last post by:
Does anyone know how I can determine how many visible rows there are in a vb.net Listview? There is no listview "visible row count" property like there is for a datagrid. Tks in advance for any...
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...
4
by: John Dann | last post by:
I have a listview control on a simple vb.net form that's populated programmatically. It is set to scrollable and a scroll bar duly appears. However the scroll bar doesn't allow the bottom rows of...
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...
5
by: Nathan Sokalski | last post by:
I have a DataList that I was having trouble getting the events for. After a bit of help, I realized that I needed to put the databinding inside an If Not IsPostBack() condition. Although this fixed...
0
by: lsharva | last post by:
Actually, i m working on Windows Application where i have to use the ComboBox and listview in a way , as first we will click the comboBox and then as you click , ListView appear and when we...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.