Guest User

Untitled

a guest
Mar 22nd, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. namespace WindowsFormsApp1
  2. {
  3. public partial class Form1 : Form
  4. {
  5. List<TextBox> Txt1 = new List<TextBox>();
  6. public Form1()
  7. {
  8.  
  9.  
  10. InitializeComponent();
  11.  
  12.  
  13.  
  14. for (int i = 0; i < 4; i++)
  15. {
  16.  
  17.  
  18.  
  19. for(int j = 0; j < 7; j++)
  20. {
  21. if (j == 0)
  22. {
  23. var txtbox = new TextBox();
  24. txtbox.Location = new Point(163 + (i * 220), (36));
  25. txtbox.Name = i + "Names";
  26. txtbox.Text = txtbox.Name;
  27. txtbox.Width = 40;
  28. this.Controls.Add(txtbox);
  29.  
  30.  
  31. }
  32. else if (j>0 && j<6)
  33. {
  34.  
  35. var extratxt = new TextBox();
  36. extratxt.Location = new Point(163 + (i * 220), (36+ 36 * j));
  37. extratxt.Name = i + "Input" + j;
  38. extratxt.Text = extratxt.Name;
  39. extratxt.Width = 70;
  40. this.Controls.Add(extratxt);
  41.  
  42. var percentbox = new Label();
  43. percentbox.Location = new Point(163 + (90+ i * 220), (36 + 36 * j));
  44. percentbox.Name = i + "Percent" + j;
  45. percentbox.Text = percentbox.Name;
  46. percentbox.Width = 50;
  47. this.Controls.Add(percentbox);
  48.  
  49. var gradebox = new Label();
  50. gradebox.Location = new Point(163 + (150 + i * 220), (36 + 36 * j));
  51. gradebox.Name = i + "Grade" + j;
  52. gradebox.Text = gradebox.Name;
  53. gradebox.Width = 50;
  54. this.Controls.Add(gradebox);
  55. }
  56.  
  57. else
  58. {
  59. var totals = new Label();
  60. totals.Location = new Point(163 + (i * 220), (36 + 36 * j));
  61. totals.Name = i + "Total";
  62. totals.Text = totals.Name;
  63. totals.Width = 40;
  64. this.Controls.Add(totals);
Add Comment
Please, Sign In to add comment