Create controls dynamically

Posted by Afnan on Stack Overflow See other posts from Stack Overflow or by Afnan
Published on 2011-01-18T00:47:07Z Indexed on 2011/01/18 0:53 UTC
Read the original article Hit count: 232

Filed under:
|
|

I want to know if this is possible in c# winform.

create control when ever button is pressed and place it at given location.

I think it is possible like this

private TextBox txtBox = new TextBox();
private Button btnAdd = new Button();
private ListBox lstBox = new ListBox();
private CheckBox chkBox = new CheckBox();
private Label lblCount = new Label();

but the problem lies when ever button is pressed same name controls are created.How to avoid that

© Stack Overflow or respective owner

Related posts about c#

Related posts about controls