How to Generate .cs file at Runtime 
Author Message
 How to Generate .cs file at Runtime

Hi
I am developing one application , used to design the forms , which will be
used by some other application later.
This application has its own toolbox with limited controls.

I would like to create .cs file at runtime based on the controls drawn on
the Panel. I am using CodeDOM to generate the code. I am able to generate
the code for all like class constructor, all the Private Member variables,
dispose method. But I don't know how to generate the code for the method
"InitializeComponent()".

The Method "InitializeComponent()" will look like this.
In this method only the limited properties (whose value changed from
default)  will be displayed.

 private void InitializeComponent()
  {
   this.textBox1 = new System.Windows.Forms.TextBox();
   this.SuspendLayout();
   //
   // textBox1
   //
   this.textBox1.Location = new System.Drawing.Point(192,88);
   this.textBox1.Name = "textBox1";
   this.textBox1.Size = new System.Drawing.Size(96, 20);
   this.textBox1.TabIndex = 0;
   this.textBox1.Text = "textBox1";
   //
   // Form2
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
   this.ClientSize = new System.Drawing.Size(424, 318);
   this.Controls.AddRange(new System.Windows.Forms.Control[]
{              this.textBox1});
   this.Name = "Form2";
   this.Text = "Form2";
   this.ResumeLayout(false);

  }
How to genrate code for InitializeComponent() for the controls drwan on the
Control Panel in my application.
Kindly help me out on this.

Thnaks in Advnace

Karuppasamy N



Mon, 16 May 2005 12:49:59 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Newbie: separate big .cs file into small .cs files

2. Reference.cs Generated with Parameters Reversed

3. resx files needed for cs - files ??

4. CS files display in VS6 like CPP files ?

5. How to generate Function calls at Runtime?

6. Visual C++ 6.0 Ide generates runtime Error on Startup

7. How to generate Function calls at Runtime?

8. Include code in other Cs files

9. Reuse of cs files, namespace, arch advice pls

10. Two CS files (using namespaces)

11. My .cs files were deleted!?

12. manipulating server controls in the Codebehind .cs file

 

 
Powered by phpBB® Forum Software