Home All Groups Group Topic Archive Search About

Dynamically load a form

Author
18 Dec 2006 9:43 PM
kendu
Is it possible to dynamically load a form from file?  This form is just
a .vb file and has not been added to the project during design time.

Ken

Author
18 Dec 2006 10:54 PM
Spam Catcher
"kendu" <ken***@yahoo.com> wrote in news:1166478195.854118.192180
@l12g2000cwl.googlegroups.com:

> Is it possible to dynamically load a form from file?  This form is just
> a .vb file and has not been added to the project during design time.

Yes, you can use reflection (System.Reflection namespace) to dynamically
load classes - either from an assembly (DLL) or from source code (from
source code you'll need to dynamically compile the file too).
Author
19 Dec 2006 6:23 AM
kend9u
Spam Catcher wrote:
> "kendu" <ken***@yahoo.com> wrote in news:1166478195.854118.192180
> @l12g2000cwl.googlegroups.com:
>
> > Is it possible to dynamically load a form from file?  This form is just
> > a .vb file and has not been added to the project during design time.
>
> Yes, you can use reflection (System.Reflection namespace) to dynamically
> load classes - either from an assembly (DLL) or from source code (from
> source code you'll need to dynamically compile the file too).

The idea is to generate forms at run-time then view them.  Thanks, SC.
Wonder if there is any good code example?  I know, it's getting kind of
gritty :-)
Author
19 Dec 2006 7:20 AM
Michael C
"kend9u" <vlong***@gmail.com> wrote in message
news:1166509391.058379.206560@t46g2000cwa.googlegroups.com...
> The idea is to generate forms at run-time then view them.  Thanks, SC.
> Wonder if there is any good code example?  I know, it's getting kind of
> gritty :-)

Why not generate them using native code? Why write it to a file?

Show quoteHide quote
>
Author
19 Dec 2006 2:54 PM
kendu
Michael C wrote:
> "kend9u" <vlong***@gmail.com> wrote in message
> news:1166509391.058379.206560@t46g2000cwa.googlegroups.com...
> > The idea is to generate forms at run-time then view them.  Thanks, SC.
> > Wonder if there is any good code example?  I know, it's getting kind of
> > gritty :-)
>
> Why not generate them using native code? Why write it to a file?
>
> >

We're going to re-use the generated forms by adding them to other
projects, Michael.  Got the source code for the forms generated and
written to disk files already.  The next step would be compiling and
displaying these files at run-time.  "Quick and dirty" ways to
accomplish the tasks are much appreciated.  Any wrapper to handle it
out there?

Ken
Author
19 Dec 2006 12:50 AM
Michael C
"kendu" <ken***@yahoo.com> wrote in message
news:1166478195.854118.192180@l12g2000cwl.googlegroups.com...
> Is it possible to dynamically load a form from file?  This form is just
> a .vb file and has not been added to the project during design time.

This is not a good way to do what I think you're trying to achive (addin
sort of functionality). The form should be compiled into a dll and then the
dll should be loaded.

Show quoteHide quote
>
> Ken
>
Author
19 Dec 2006 11:38 PM
Spam Catcher
"Michael C" <nospam@nospam.com> wrote in
news:OucgtZwIHHA.4712@TK2MSFTNGP04.phx.gbl:

> This is not a good way to do what I think you're trying to achive
> (addin sort of functionality). The form should be compiled into a dll
> and then the dll should be loaded.

Yes, I agree, that is the better way.

Another possiblity is to use the VS.NET designer component to serialize a
generated form. The form can then be easily reloaded or transferred to
another app.
Author
20 Dec 2006 5:43 AM
kendu
Michael C wrote:
> "kendu" <ken***@yahoo.com> wrote in message
> news:1166478195.854118.192180@l12g2000cwl.googlegroups.com...
> > Is it possible to dynamically load a form from file?  This form is just
> > a .vb file and has not been added to the project during design time.
>
> This is not a good way to do what I think you're trying to achive (addin
> sort of functionality). The form should be compiled into a dll and then the
> dll should be loaded.
>
> >
> > Ken
> >

Hi Michael,

I just came across a post that is in line with what you mention about
compiling a form into a DLL. Could you take a look:

http://groups.google.com/group/microsoft.public.dotnet.languages.vb/browse_thread/thread/b4d63b587a21498a/8940f38359604965?lnk=gst&q=kendu&rnum=1&hl=en#8940f38359604965