c# - How to make autogeneration of buttons in a form by getting labels and button names from database? -
I want to get labels and button names from the database and make the autogeneration of buttons in one form. I'm coding in C # Visual Studio 2013.WinForms, the device's direction of how to obtain the label name and code in C # is sufficient.
You say that text boxes and label names in writing
List & lt; String & gt; Label = new list & lt; String & gt; (); & Lt; String & gt; Text box = new list & lt; String & gt; ();
Then you simply infiltrate through them, make controls and put them on your form like this:
For (int a = 0; a & lt; label; count; a ++) {label l = new label (); L. location = new point (5,5 + one * 20); L.Text = Label [A]; This.Controls.Add (L); } For (int a = 0; a & lt; textboxes.count; a ++) {text box T = new text box (); Tl.Location = new point (100,5 + one * 20); T. Text = text box [A]; This.Controls.Add (t); }
Comments
Post a Comment