Dynamic forms

  • Thread starter Thread starter AA2e72E
  • Start date Start date
A

AA2e72E

Given a C# form (and its controls) that is created dynamically i.e.
programatically rather than using the IDE, is there a way of writing that
form's definition to a .CS file?
 
AA2e72E said:
Given a C# form (and its controls) that is created dynamically i.e.
programatically rather than using the IDE, is there a way of writing that
form's definition to a .CS file?


Do you mean generating a form's layout at runtime and saving the results as
a form class in a .cs file
....or do you mean writing a program in notepad and being able to view it in
the VC# designer (for instance)?
 
I mean "generating a form's layout at runtime and saving the results as
a form class in a .cs file".

I am hoping that, if this is possible, all the properties of controls
(including ones that I may not have explicitly set) will be written to he CS
file.
 
AA2e72E said:
I mean "generating a form's layout at runtime and saving the results as
a form class in a .cs file".

I am hoping that, if this is possible, all the properties of controls
(including ones that I may not have explicitly set) will be written to he
CS
file.


Saving the "state" of the form is easy compared to what you want to do...


I think the most intuitive way to accomplish this is to write to a XML or
some other file format immediately before or after every UI modification
statement (new button, change label text, whatever). Basically it will keep
a log of created controls and property changes.


If you keep your XML tag (node) structure _highly_ standardized, you should
be able to quickly parse the data back into a .cs file with some simple yet
elaborate control, iteration, and selection statements.


That's the best I have, but I would love to know how this goes, with
whatever avenue you take. Actually it sounds fun, but I'm playing with
databases today.
 
Given a C# form (and its controls) that is created dynamically i.e.
programatically rather than using the IDE, is there a way of writing that
form's definition to a .CS file?

Have you looked at WPF?
 
I know what the acronymn stands for; I believe it is only available in C#
3.0? I am using C# 2.0.

Can you give me a more helpful clue, please?
 
AA2e72E said:
I know what the acronymn stands for; I believe it is only available in C#
3.0? I am using C# 2.0.

Well, it's available from .NET 3.0. The version of C# is a somewhat
different story.

Perhaps you could tell us more about what you're actually trying to do
and why?
 
Back
Top