Event Handling in C# Triggering a Button
Answer / guest
using System;
using System.Windows.Forms;
using System.Drawing;
public class Butevent:Form {
TextBox t1 = new TextBox();
Button b1 = new Button();
public Butevent() {
this.Text = "C# Program ";
t1.Location = new Point(20,30);
b1.Text = "Click here to activate";
b1.Location = new Point(20,55);
b1.Size = new Size(150,20);
// Invoking Method or EventHandler
b1.Click+=new EventHandler(OnClick);
this.Controls.Add(t1);
this.Controls.Add(b1);
// Invoking Method or EventHandler
this.Resize += new EventHandler(OnResize);
}
//Applying EventHandler
public void OnResize(object sender,EventArgs ee) {
MessageBox.Show("oops! Form Resized");
}
//Applying EventHandler
public void OnClick(object sender,EventArgs e) {
t1.Text = "Hello C#";
}
public static void Main() {
Application.Run(new Butevent());
}
}
Is This Answer Correct ? | 2 Yes | 2 No |
working with arrays
program to check if a number is "perfect number".
How to Create a Treeview Menu in ASP.NET with C#?
Code for Reading and writing from a file in c#?
Code for Working with Files under a Directory?
. Write a program to print the following outputs using for loops $ $ $ $ $ $ $ $ $ $ $ $ $ $ $
How to Create Files by Using the FileInfo Class?
IS Array list is generic or non generic
How to Link Different Data Sources Together?
Write a program to convert postfix expression to infix expression.
Write a program. there are 1..n numbers placed in an array in random fashion with one integer missing. find the missing number.
Coding for Manipulate XML File Data Using C#?