For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > November 2005 > Using a form as a variable









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Using a form as a variable
Elmo Watson

2005-11-27, 6:55 pm

I have one form (let's call it frmDemo) I'd like to call from many different
forms.
Using variables I populate on that form, when I get back to the form it
started from, I need it to do whatever it needs to do on that particular
form. When calling frmDemo, it hides the current form and then, when frmDemo
unloads - - among the things it needs to do, is to 'Show' the form that
called it

But - I'm not sure how to do it...

Here's what I've tried :
mgForm as Form (global variable)

just before I call/show frm Demo - I need to assign the active form (let's
call it frmOne) to the global variable.

I've tried
mgForm=Me and mgForm=frmOne - - none of that works - I get 'Invalid use of
Property'

Can someone please tell me how I can accomplish this?


Bob Butler

2005-11-27, 6:55 pm

"Elmo Watson" <sputnik@nospam.yahoo.com> wrote in message
news:%23AfN%23w58FHA.3104@TK2MSFTNGP10.phx.gbl
> I have one form (let's call it frmDemo) I'd like to call from many
> different forms.
> Using variables I populate on that form, when I get back to the form
> it started from, I need it to do whatever it needs to do on that
> particular form. When calling frmDemo, it hides the current form and
> then, when frmDemo unloads - - among the things it needs to do, is
> to 'Show' the form that called it
>
> But - I'm not sure how to do it...
>
> Here's what I've tried :
> mgForm as Form (global variable)
>
> just before I call/show frm Demo - I need to assign the active form
> (let's call it frmOne) to the global variable.
>
> I've tried
> mgForm=Me and mgForm=frmOne - - none of that works - I get 'Invalid
> use of Property'
>
> Can someone please tell me how I can accomplish this?


Set mgForm=Me
frmDemo.Show

you might also consider just showing frmDemo as a modal form:

frmDemo.Show vbModal, Me
Msgbox "frmDemo done"

The 'vbModal' causes the calling form to be suspended until frmDemo is no
longer visible and the 'Me' argument tells the system to always keep frmDemo
on top of the calling form. When you hide frmDemo the code in the calling
form will continue and the msgbox will appear.

--
Reply to the group so all can participate
VB.Net: "Fool me once..."

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com