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

python - Mongodb How to add addtional information when aggregating? -

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

ruby - Net::HTTP extremely slow responses for HTTPS requests -