ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   userform property change race (https://www.excelbanter.com/excel-programming/410067-userform-property-change-race.html)

Luke Alcatel[_4_]

userform property change race
 
I have a msforms.listbox on a userform and I wrote code to sort rows of the
list by column when I click a column heading. There are a few problems that
I found by googling such as column headers are broken and they must be
created with labels on top of the list box but my code works. For a large
table of several thousand rows I want to tell the user to "Wait" by changing
the caption of a label on the form and then sorting but I found that the
caption changes after the sort completes rather than before. I have code
lines to change the caption and call my sort function consecutively. If I
single step the lines the caption changes first but when I execute normally
the caption changes last.

My hypothesis is that underneath the hood there must be Windows message
passing going on and it looses a race to the start of my sort function which
presumably dominates the interpreter unit it completes. How can I insure
that the label caption will change first?

LA



Tim Williams

userform property change race
 
Have you tried refreshing the form (using Me.Repaint) after changing the
label ?

Tim


"Luke Alcatel" wrote in message
...
I have a msforms.listbox on a userform and I wrote code to sort rows of the
list by column when I click a column heading. There are a few problems
that
I found by googling such as column headers are broken and they must be
created with labels on top of the list box but my code works. For a large
table of several thousand rows I want to tell the user to "Wait" by
changing
the caption of a label on the form and then sorting but I found that the
caption changes after the sort completes rather than before. I have code
lines to change the caption and call my sort function consecutively. If I
single step the lines the caption changes first but when I execute
normally
the caption changes last.

My hypothesis is that underneath the hood there must be Windows message
passing going on and it looses a race to the start of my sort function
which
presumably dominates the interpreter unit it completes. How can I insure
that the label caption will change first?

LA





Luke Alcatel[_4_]

userform property change race
 
Thanks - that works. I had not known of the repaint function.

"Tim Williams" <timjwilliams at gmail dot com wrote in message
...
Have you tried refreshing the form (using Me.Repaint) after changing the
label ?

Tim


"Luke Alcatel" wrote in message
...
I have a msforms.listbox on a userform and I wrote code to sort rows of

the
list by column when I click a column heading. There are a few problems
that
I found by googling such as column headers are broken and they must be
created with labels on top of the list box but my code works. For a

large
table of several thousand rows I want to tell the user to "Wait" by
changing
the caption of a label on the form and then sorting but I found that the
caption changes after the sort completes rather than before. I have

code
lines to change the caption and call my sort function consecutively. If

I
single step the lines the caption changes first but when I execute
normally
the caption changes last.

My hypothesis is that underneath the hood there must be Windows message
passing going on and it looses a race to the start of my sort function
which
presumably dominates the interpreter unit it completes. How can I

insure
that the label caption will change first?

LA








All times are GMT +1. The time now is 05:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com