May i know how to create textbox using code and store the design in window form, next time i open the form that must be same as previous i designed.

Recommended Answers

All 3 Replies

Hi Howard, I'm not sure what you're asking for.

  • Have you created a windows form using code?
  • Do you want to create this textbox before the appliction is run?
// Initialize a new textbox
TextBox txt = new TextBox();
// Set the dimension and location
txt.Top = 10;
txt.Left = 10;
txt.Width = 100;
txt.Height = 25;
// Set the visibility and add it to the form
txt.Visible = true;
this.Controls.Add(txt);

For saving....

Save all the controls with their properties in a text file and load the control at runtime.....

I have attached a solution that uses a simple logic to create textbox at runtime. The program stores the no of textboxes created in a file. And on page load, reads the file and creates the textboxes.

This may not fit your situation but give u an idea on how to continue....

P.S.

The attached file is just my way of implementing your idea. There are ofcourse many other effective algorithm available

thanks samsylvestertty this is what i want.
and thanks ChrisHunter too, sorry i not reply you because that day i not open computer.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.