
Can't set the .Tag for a form (VB4) - Testform.zip (0/1)
Quote:
> Can anyone explain this...
> [snip]
> Now here is the problem. When I click on GetFile (ie.
> cammand2_click), I see the msgbox listed inside the frmGetFile
> form_load event, and then the msgbox in the command2_click event. Why
> is this? Secondly, when it shows the msgbox from inside frmGetFile
> form_load, it shows Me.Tag is "". Why can I set the Tag inside the
> form, but not before calling the form?
When you set frmGetFile, VB has to load that form before it can set the property.
So VB does its thing and fires off the load event of frmGetFile.
All of that code runs and you get you message box in fmrGetFile, but the tag
has not yet been set so it is empty. When frmGetFile_load completes, control is
retruned back to the click event where the tag is being set and you are
getting your second message box.
What you might want to do is move your code to the activate event instead
of the load event. That way, the form will load, the tag will be set and
then your code will actually run when you do the modal show.
JJ Brychell - My opinions are my own and not necessarily