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

form activate event and listview sort

I have a form which contains a listview item. The form is created to view
data that is generated by interaction with a separate form.

There are buttons on the form that change the data source that is
displayed in the listview. The listview can be sorted by clicking on
columns in the listview.

When I change the data for the listview I use listview1.Clear() to clear
the listview, then rebuild the listview by adding the proper columns and
subitems.

This all works fine except that if I first sort by a column and then
change the view (which does a .Clear() on the listview, then adds columns
and subitems), I get an unhandled exception in my listview sort routine.
It is complaining about an index out of range when comparing values from
two different rows in the listview.

I'm not sure where exactly in the process this happens, but the basic
problem is this: Why is the sort routine being called at all? It should
only be called when a column is clicked, and this hasn't happened.

On a possibly related note, I use the form_activated event to detect when
the form is brought to the front so I can refresh the data in the
listview. When I trace through the execution of the code, the
form_activated event seems to occur multiple times--how come?

Thanks for any help.

Terry Brown
www.stickmansoftware.com

Dec 27 '05 #1
0 1763

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

Similar topics

0
by: Brad | last post by:
Hi everyone, I am trying to sort columns in a listview. When the user clicks on a column I want to sort on that column. The kicker is, I don't know how to trap for the column click for the...
1
by: June Homer | last post by:
I have a form which has its activate event set to maximise the form. This used to work but no long does. I have put a breakpoint in the Activate event and it is never trapped. The form is opened...
9
by: MLH | last post by:
Say I open a form (MyForm) in design view, then I close it and dbl-click it in the database window to open it. Shouldn't the Activate event occur in all such situations? What might the case(s) be...
2
by: MLH | last post by:
I have the following tasks to perform on an unbound form. I want them to run every time I return to the form. For reasons not at issue here, I do not close the form with a docmd.close command. I...
2
by: Aaron Queenan | last post by:
Is there any way to know whether the OnItemCheck is being called in response to a user action (mouse or keyboard) as opposed to the form loading? I have a class which derives from...
7
by: Tyler Foreman | last post by:
Hello, I have a strange problem that occurs every so often in my application. It usually takes place when I hide one form and activate another. What happens is I get the following exception:...
3
by: MikeY | last post by:
Hi everyone, I'm having problems, or should I say still having problems with trying to pass data from my custom buttons in my custom controls to my main form listview box. Still scratching my...
9
by: Dimsion | last post by:
Hi, How do i expose all my forms and it controls to other form in the project? I want to be able to add a form and some control on it, this then be available to all other forms. form1 click...
7
by: Pygmalion | last post by:
Hello experts, I want to use Form_Keydown event in my program. However, it turns out that one of the form controls is always in focus, so Form_Keydown event is never invoked. I tried to set...
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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:
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...

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.