Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

Dynamic forms

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
AA2e72E - 11 Mar 2008 10:24 GMT
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?
Roger Frost - 11 Mar 2008 10:42 GMT
> 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)?

Signature

Roger Frost
"Logic Is Syntax Independent"

AA2e72E - 11 Mar 2008 11:07 GMT
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.
Roger Frost - 11 Mar 2008 11:35 GMT
> I mean "generating a form's layout at runtime and saving the results as
> a form class in a .cs file".
[quoted text clipped - 3 lines]
> 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.

Signature

Roger Frost
"Logic Is Syntax Independent"

csharp@elfware.za.net - 11 Mar 2008 15:09 GMT
On Mar 11, 11:24 am, AA2e72E <AA2e...@discussions.microsoft.com>
wrote:
> 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?
AA2e72E - 11 Mar 2008 16:34 GMT
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?
Jon Skeet [C# MVP] - 11 Mar 2008 16:48 GMT
> 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?

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.