PC Review


Reply
Thread Tools Rate Thread

2 userforms, 2 UserForm_Initialize()

 
 
Charlie
Guest
Posts: n/a
 
      26th Dec 2007
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...


 
Reply With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      26th Dec 2007
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...
>
>

 
Reply With Quote
 
Charlie
Guest
Posts: n/a
 
      26th Dec 2007
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...
> >
> >

 
Reply With Quote
 
Joel
Guest
Posts: n/a
 
      26th Dec 2007
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...
> > >
> > >

 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      26th Dec 2007
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...
>
>

 
Reply With Quote
 
Charlie
Guest
Posts: n/a
 
      26th Dec 2007
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...
> >
> >

 
Reply With Quote
 
Charlie
Guest
Posts: n/a
 
      26th Dec 2007
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...
> >
> >

 
Reply With Quote
 
Darren Hill
Guest
Posts: n/a
 
      26th Dec 2007
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...
>>>
>>>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ComboBox and UserForm_Initialize =?Utf-8?B?U2NvdHQ=?= Microsoft Word Document Management 5 29th Apr 2006 06:08 PM
UserForm_Initialize RB Smissaert Microsoft Excel Programming 4 13th Apr 2006 04:49 PM
UserForm_Initialize() Joe Derr Microsoft Excel Programming 3 4th Dec 2004 04:23 AM
UserForm_Initialize Rob Microsoft Excel Programming 2 15th Jan 2004 02:00 PM
UserForm_Initialize? How to update. Jelso Microsoft Excel Programming 2 5th Sep 2003 07:51 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:14 PM.