-
Mar 26th, 2015, 03:53 PM
#1
Thread Starter
Member
create a dynamic form
I wonder if it is possible to create a form at run time. I do not want to instantiate an existing class
Please, help me
-
Mar 26th, 2015, 04:07 PM
#2
Re: create a dynamic form
yes it's possible. You do it the same way you'd create a dynamic control with the New keyword. Then use AddHandler to hook up events, add dynamic controls and handlers for those too...
That's all there is to it.
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Mar 26th, 2015, 04:45 PM
#3
Re: create a dynamic form
Heck, if you look at the designer file you'll see that's exactly how it's done... all of the controls are created at run time, then added to the form. It's just that the IDE then takes that designer file and gives you a warm, soft GUI to work with. There's nothing to say that you can't hand-code it all yourself. But you're still instanciating a class (the form) ... so unless there's a fluid reason for doing so, there really isn't much point in it (other than an exercise in "gee this is far easier to do in the IDE").
-tg
-
Mar 26th, 2015, 04:59 PM
#4
Re: create a dynamic form
The only time i've ever created my own forms that way was when creating an app that used the CodeDomProvider class to create executables...
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Mar 26th, 2015, 05:00 PM
#5
Re: create a dynamic form
You also don't need a designer file. Those were only introduced with the 2005 version when partial classes were added. Prior to that, all the designer code was just stuck into a region in the one and only code file for the form.
My usual boring signature: Nothing
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|