winforms - Dynamically add components to windows form C# -


i trying add list of strings used text component of labels on windows form. below code using this. have generating message box show me being created, when add them form, first string ever shown on form, despite message box popping each string indicating list populated correctly. great.

list<label> labellist;      public void showdialog(list<string> columns)     {         labellist = new list<label>();         form updatedialog = new form();         updatedialog.width = 500;         updatedialog.height = 500;           (int = 0; < columns.count(); i++ )         {             //label label = new label() {text=columns[i].tostring() };              labellist.add(new label() {text=columns[i].tostring()});         }          (int j = 0; j < labellist.count(); j++ )         {              updatedialog.controls.add(labellist[j]);             messagebox.show(labellist[j].text.tostring());         } 

you need set location of created labels. positioned on top of each other @ location (0, 0).


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -