Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace WindowsFormsApp1
- {
- public partial class Form1 : Form
- {
- List<TextBox> Txt1 = new List<TextBox>();
- public Form1()
- {
- InitializeComponent();
- for (int i = 0; i < 4; i++)
- {
- for(int j = 0; j < 7; j++)
- {
- if (j == 0)
- {
- var txtbox = new TextBox();
- txtbox.Location = new Point(163 + (i * 220), (36));
- txtbox.Name = i + "Names";
- txtbox.Text = txtbox.Name;
- txtbox.Width = 40;
- this.Controls.Add(txtbox);
- }
- else if (j>0 && j<6)
- {
- var extratxt = new TextBox();
- extratxt.Location = new Point(163 + (i * 220), (36+ 36 * j));
- extratxt.Name = i + "Input" + j;
- extratxt.Text = extratxt.Name;
- extratxt.Width = 70;
- this.Controls.Add(extratxt);
- var percentbox = new Label();
- percentbox.Location = new Point(163 + (90+ i * 220), (36 + 36 * j));
- percentbox.Name = i + "Percent" + j;
- percentbox.Text = percentbox.Name;
- percentbox.Width = 50;
- this.Controls.Add(percentbox);
- var gradebox = new Label();
- gradebox.Location = new Point(163 + (150 + i * 220), (36 + 36 * j));
- gradebox.Name = i + "Grade" + j;
- gradebox.Text = gradebox.Name;
- gradebox.Width = 50;
- this.Controls.Add(gradebox);
- }
- else
- {
- var totals = new Label();
- totals.Location = new Point(163 + (i * 220), (36 + 36 * j));
- totals.Name = i + "Total";
- totals.Text = totals.Name;
- totals.Width = 40;
- this.Controls.Add(totals);
Add Comment
Please, Sign In to add comment