George William

George William

  • NA
  • 10
  • 1k

Trying to display

Feb 2 2021 2:34 AM
In my program, I have a menu on one of my windows. On clicking on one of the menu items, I link to another window. However the text meant to display in the window is not displaying. I accept the display to happen without pressing any button.
  1. private void Form1_Load(object sender, EventArgs e)  
  2. {  
  3.     // Creating and setting the label  
  4.     Label mylab = new Label();  
  5.     mylab.Text = "GeeksforGeeks";  
  6.     mylab.Location = new Point(222, 90);  
  7.     mylab.AutoSize = true;  
  8.     mylab.Font = new Font("Calibri", 18);  
  9.     mylab.BorderStyle = BorderStyle.Fixed3D;  
  10.     mylab.ForeColor = Color.Green;  
  11.     mylab.Padding = new Padding(6);  
  12.   
  13.     // Adding this control to the form  
  14.     this.Controls.Add(mylab);  
  15.   
  16.     // Creating and setting the label  
  17.     Label mylab1 = new Label();  
  18.     mylab1.Text = "Welcome To GeeksforGeeks";  
  19.     mylab1.Location = new Point(155, 170);  
  20.     mylab1.AutoSize = true;  
  21.     mylab1.BorderStyle = BorderStyle.Fixed3D;  
  22.     mylab1.Font = new Font("Calibri", 18);  
  23.     mylab1.Padding = new Padding(6);  
  24.   
  25.     // Adding this control to the form  
  26.     this.Controls.Add(mylab1);  
  27. }  
When the window loads, its turns up empty.

Answers (1)