Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Variable Msg's scope is within this method
- */
- string Msg = "Clicked";
- /*
- * Use Object Intilizer
- */
- Button BTN_1 = new Button()
- {
- Text = "Click Me",
- Size = new Size(100, 20),
- Location = new Point(5, 5)
- };
- /*
- * Define what the button click event does within this method
- * This way you can use variables with limited scope
- */
- BTN_1.Click += delegate
- {
- MessageBox.Show(Msg);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement