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

Find 'TopIndex' in a listbox

Is there any way to find the ListIndex of the first items displayed in
a listbox that is partially scrolled (i.e. the equivalent of TopIndex
for a VB listbox)?

I want to be able to redisplay the listbox at exactly the same
position after an event that causes the scrollbar to reset to the top.
I've seen Stephen Lebans method for setting the scrollbar so that a
specific item is at the top of the box, but what I don't see how to do
is find out what the item at the top of the box is before the
scrollbar resets - Stephen's examples rely on you knowing beforehand
the ListIndex of the row you want to display.

(Just to complicate thing, the listboxis resizable, so i don't know
how many rows it will display at runtime).

Thanks!

Ian

Jun 7 '07 #1
3 3607
I've added support for ListBox ScrollBars to the GetSetScrollBar solution. I
haven't published it yet to my site. If you send me an EMail I'll trply with
the updated MDB.
My*********@MyLastName.com
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"ians" <ia******@yahoo.co.ukwrote in message
news:11**********************@p47g2000hsd.googlegr oups.com...
Is there any way to find the ListIndex of the first items displayed in
a listbox that is partially scrolled (i.e. the equivalent of TopIndex
for a VB listbox)?

I want to be able to redisplay the listbox at exactly the same
position after an event that causes the scrollbar to reset to the top.
I've seen Stephen Lebans method for setting the scrollbar so that a
specific item is at the top of the box, but what I don't see how to do
is find out what the item at the top of the box is before the
scrollbar resets - Stephen's examples rely on you knowing beforehand
the ListIndex of the row you want to display.

(Just to complicate thing, the listboxis resizable, so i don't know
how many rows it will display at runtime).

Thanks!

Ian

Jun 8 '07 #2
Hi Stephen

tried emailing you as you suggested, but maybe it got lost as spam.
Anyway i'd still be interested in your solution.
Thanks

ian

On Jun 8, 2:41 am, "Stephen Lebans" <ForEmailGotoMy.WebSite.-
WWWdotlebansdot...@linvalid.comwrote:
I've added support for ListBox ScrollBars to the GetSetScrollBar solution. I
haven't published it yet to my site. If you send me an EMail I'll trply with
the updated MDB.
MyFirstN...@MyLastName.com

--

HTH
Stephen Lebanshttp://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.

"ians" <ians0...@yahoo.co.ukwrote in message

news:11**********************@p47g2000hsd.googlegr oups.com...
Is there any way to find the ListIndex of the first items displayed in
a listbox that is partially scrolled (i.e. the equivalent ofTopIndex
for a VB listbox)?
I want to be able to redisplay the listbox at exactly the same
position after an event that causes the scrollbar to reset to the top.
I've seen Stephen Lebans method for setting the scrollbar so that a
specific item is at the top of the box, but what I don't see how to do
is find out what the item at the top of the box is before the
scrollbar resets - Stephen's examples rely on you knowing beforehand
the ListIndex of the row you want to display.
(Just to complicate thing, the listboxis resizable, so i don't know
how many rows it will display at runtime).
Thanks!
Ian

Jun 18 '07 #3
Sorry Ian,

Your reply ended up in my SPAM Email folder. I've emailed you the modified
MDB.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"ians" <ia******@yahoo.co.ukwrote in message
news:11**********************@n2g2000hse.googlegro ups.com...
Hi Stephen

tried emailing you as you suggested, but maybe it got lost as spam.
Anyway i'd still be interested in your solution.
Thanks

ian

On Jun 8, 2:41 am, "Stephen Lebans" <ForEmailGotoMy.WebSite.-
WWWdotlebansdot...@linvalid.comwrote:
>I've added support for ListBox ScrollBars to the GetSetScrollBar
solution. I
haven't published it yet to my site. If you send me an EMail I'll trply
with
the updated MDB.
MyFirstN...@MyLastName.com

--

HTH
Stephen Lebanshttp://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.

"ians" <ians0...@yahoo.co.ukwrote in message

news:11**********************@p47g2000hsd.googleg roups.com...
Is there any way to find the ListIndex of the first items displayed in
a listbox that is partially scrolled (i.e. the equivalent ofTopIndex
for a VB listbox)?
I want to be able to redisplay the listbox at exactly the same
position after an event that causes the scrollbar to reset to the top.
I've seen Stephen Lebans method for setting the scrollbar so that a
specific item is at the top of the box, but what I don't see how to do
is find out what the item at the top of the box is before the
scrollbar resets - Stephen's examples rely on you knowing beforehand
the ListIndex of the row you want to display.
(Just to complicate thing, the listboxis resizable, so i don't know
how many rows it will display at runtime).
Thanks!
Ian


Jun 20 '07 #4

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

Similar topics

17
by: amber | last post by:
Hello. Can someone tell me what I may be doing wrong here? I'm using the code (lboxRP is a listbox): Dim newRPindex As Integer newRPindex = Me.lboxRP.FindString(RP)...
4
by: f_salazar | last post by:
English Version !! Hi !! I have a page with a Form, inside the form I have listbox with 'X' elements. Wend I submit the page, an ASP process inside the page have to read those elements and...
3
by: Paul T. Rong | last post by:
I have a listbox (of product names) control on my form. I want to pass the selected item (a product name) to a subform, and the product unitprice should apear automatically next to the product name...
3
by: Sarah Smith via AccessMonster.com | last post by:
I am creating a database of documents that need to be worked on, are int eh proress of being worked on, and have been completed. Sometimes the same document (an updated version) comes back for more...
8
by: jquest | last post by:
Hi Again; I have had help from this group before and want to thank everyone, especially PCDatasheet. My database includes a field called HomePhone, it uses the (xxx)xxx-xxx format to include...
6
by: Chris Leuty | last post by:
I am populating a multiselect Listbox from a dataset, with the content of the listbox filled by one table, and the selections determined from another table. So far, I have been keeping the dataset...
7
by: Dave | last post by:
Hi all, After unsuccessfully trying to make my own dual listbox control out of arraylists, I decided to look for a 3rd party control. I've looked for over a week now and can't find anything but...
3
by: Ali Chambers | last post by:
Hi, I have created a listbox called "dtlist1" on my VB.NET form. I call a procedure as follows: Private Sub openfile(flname As String) dtlist1.Items.Clear() etc..
2
by: GS | last post by:
I want to create a dropdownlistbox in my windows form with name value pair. but I need to initialize its initial selected value to a value from database for the record. I was going to just use...
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: 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?
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
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,...
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,...

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.