ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   2 userforms, 2 UserForm_Initialize() (https://www.excelbanter.com/excel-programming/403231-2-userforms-2-userform_initialize.html)

Charlie

2 userforms, 2 UserForm_Initialize()
 
To refresh the form, I just call UserForm_Initialize()
(Because I discovered .hide & .show again doesn't do this)
But both userforms I have have UserForm_Initialize() even though I named
both userforms something else. Does this matter. My code seems to know to
call the UserForm_Initialize() on the active form...



joel

2 userforms, 2 UserForm_Initialize()
 
If you are using comboboxes or listboxes on userforms they don't empty
automatically. They maintain the values you last put into them even if you
close your workbook and re-open the workbook. You must perform a .clear to
empty these boxes.

Now for your question. You can use the initialize function if the
initialize function does everything you need it to do. Does your Initialize
function clear comboboxes and listboxes?

"Charlie" wrote:

To refresh the form, I just call UserForm_Initialize()
(Because I discovered .hide & .show again doesn't do this)
But both userforms I have have UserForm_Initialize() even though I named
both userforms something else. Does this matter. My code seems to know to
call the UserForm_Initialize() on the active form...



Charlie

2 userforms, 2 UserForm_Initialize()
 
Intesting to know that answer to my unasked ?

....I have my userform_Initialize() to fill lots of textboxes, combos, and
many labels from several worksheets. But if it's not kosher to call
userform_Initialize() I can just put my form loading code under a private sub
and call that from userform_Initialize...
thanks.

"Joel" wrote:

If you are using comboboxes or listboxes on userforms they don't empty
automatically. They maintain the values you last put into them even if you
close your workbook and re-open the workbook. You must perform a .clear to
empty these boxes.

Now for your question. You can use the initialize function if the
initialize function does everything you need it to do. Does your Initialize
function clear comboboxes and listboxes?

"Charlie" wrote:

To refresh the form, I just call UserForm_Initialize()
(Because I discovered .hide & .show again doesn't do this)
But both userforms I have have UserForm_Initialize() even though I named
both userforms something else. Does this matter. My code seems to know to
call the UserForm_Initialize() on the active form...



joel

2 userforms, 2 UserForm_Initialize()
 
What ever works! I usually perform a clear, load my boxes and then execute
the .show. Putting the clear and load into the initialize also works.

"Charlie" wrote:

Intesting to know that answer to my unasked ?

...I have my userform_Initialize() to fill lots of textboxes, combos, and
many labels from several worksheets. But if it's not kosher to call
userform_Initialize() I can just put my form loading code under a private sub
and call that from userform_Initialize...
thanks.

"Joel" wrote:

If you are using comboboxes or listboxes on userforms they don't empty
automatically. They maintain the values you last put into them even if you
close your workbook and re-open the workbook. You must perform a .clear to
empty these boxes.

Now for your question. You can use the initialize function if the
initialize function does everything you need it to do. Does your Initialize
function clear comboboxes and listboxes?

"Charlie" wrote:

To refresh the form, I just call UserForm_Initialize()
(Because I discovered .hide & .show again doesn't do this)
But both userforms I have have UserForm_Initialize() even though I named
both userforms something else. Does this matter. My code seems to know to
call the UserForm_Initialize() on the active form...



JLGWhiz

2 userforms, 2 UserForm_Initialize()
 
If you unload the form after each use instead of hiding it, then when you use
..show it will automatically invoke load and initialize.

"Charlie" wrote:

To refresh the form, I just call UserForm_Initialize()
(Because I discovered .hide & .show again doesn't do this)
But both userforms I have have UserForm_Initialize() even though I named
both userforms something else. Does this matter. My code seems to know to
call the UserForm_Initialize() on the active form...



Charlie

2 userforms, 2 UserForm_Initialize()
 
ah, that's the word I was looking for, unload. That'll do what i need, nicely.
"JLGWhiz" wrote:

If you unload the form after each use instead of hiding it, then when you use
.show it will automatically invoke load and initialize.

"Charlie" wrote:

To refresh the form, I just call UserForm_Initialize()
(Because I discovered .hide & .show again doesn't do this)
But both userforms I have have UserForm_Initialize() even though I named
both userforms something else. Does this matter. My code seems to know to
call the UserForm_Initialize() on the active form...



Charlie

load & unload
 
I put:
Unload SchedulesForm
Load SchedulesForm
....so as to reload everything on the form, but the unload function seems to
shut down the whole code...

"JLGWhiz" wrote:

If you unload the form after each use instead of hiding it, then when you use
.show it will automatically invoke load and initialize.

"Charlie" wrote:

To refresh the form, I just call UserForm_Initialize()
(Because I discovered .hide & .show again doesn't do this)
But both userforms I have have UserForm_Initialize() even though I named
both userforms something else. Does this matter. My code seems to know to
call the UserForm_Initialize() on the active form...



Darren Hill

load & unload
 
I have this problem, too. I have two forms loaded, frm1 and frm2, and
when I use "Unload frm1", it unloads them both.

Charlie wrote:
I put:
Unload SchedulesForm
Load SchedulesForm
...so as to reload everything on the form, but the unload function seems to
shut down the whole code...

"JLGWhiz" wrote:

If you unload the form after each use instead of hiding it, then when you use
.show it will automatically invoke load and initialize.

"Charlie" wrote:

To refresh the form, I just call UserForm_Initialize()
(Because I discovered .hide & .show again doesn't do this)
But both userforms I have have UserForm_Initialize() even though I named
both userforms something else. Does this matter. My code seems to know to
call the UserForm_Initialize() on the active form...




All times are GMT +1. The time now is 03:39 PM.

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