Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Windows.Forms;
- // JOHN MICHAEL GONZALES
- // ACTIVITY 7 // BSIT CUBAO
- namespace MyNamespace
- {
- public class MyForm : Form
- {
- private TextBox textBox;
- private Button button;
- public MyForm()
- {
- // Create the TextBox control and add it to the form
- textBox = new TextBox();
- textBox.Location = new System.Drawing.Point(20, 20);
- textBox.Size = new System.Drawing.Size(200, 20);
- this.Controls.Add(textBox);
- // Create the Button control and add it to the form
- button = new Button();
- button.Location = new System.Drawing.Point(20, 50);
- button.Text = "Display Text";
- button.Click += new EventHandler(button_Click);
- this.Controls.Add(button);
- }
- private void button_Click(object sender, EventArgs e)
- {
- // Show a message box with the entered text
- MessageBox.Show(textBox.Text);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment