Creating Control at Design time
-
:rose::rose::rose: Hi. Can you tell me how can i create a control at Design time but with my own c# code. For example:
TextBox textBox=new TextBox();
textBox.Name="My textBox";
myForm.Controls.Add(textBox);
myForm.Refresh;I want to run this Code as Design Time.It works at run time but i don't want that. I want to do some thing like DataGridView that add columns at Design Time. Thank you all. :rose::rose::rose:
CanI
-
:rose::rose::rose: Hi. Can you tell me how can i create a control at Design time but with my own c# code. For example:
TextBox textBox=new TextBox();
textBox.Name="My textBox";
myForm.Controls.Add(textBox);
myForm.Refresh;I want to run this Code as Design Time.It works at run time but i don't want that. I want to do some thing like DataGridView that add columns at Design Time. Thank you all. :rose::rose::rose:
CanI
All controls are created and added in the designer.cs file for your form by default. You can look there and see where to write the code for the various aspects but be careful - you shouldn't really edit that file by hand. You should use
this
where you have writtenmyForm
above. Using the designer's drag and drop facilities is a lot quicker and easier IMO.Dave
If this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)