***** Programmer *****
Bạn có muốn phản ứng với tin nhắn này? Vui lòng đăng ký diễn đàn trong một vài cú nhấp chuột hoặc đăng nhập để tiếp tục.
***** Programmer *****

Học lập trình từ căn bản

Tìm kiếm
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Tuyên mộ thành viên
Button - II EmptyWed Oct 24, 2012 5:28 am by quangvuspkt

» Bai tap Java can ban (Phan III )
Button - II EmptySat Sep 15, 2012 4:11 am by tsuyngam

» Bai tap Java can ban (Phan I )
Button - II EmptySat Sep 15, 2012 4:08 am by tsuyngam

» Một số bài tập C# căn bản
Button - II EmptyThu Dec 15, 2011 1:58 pm by nguyenhoduykhang

» Xem thông tin máy tính bằng c#
Button - II EmptyTue Nov 08, 2011 8:19 am by namcongtu288

» My First Browser Tree Program in VB.NET
Button - II EmptyFri Aug 12, 2011 5:50 pm by kimthaohg85

» Giúp em bài C++ này với
Button - II EmptySun Jul 31, 2011 12:19 pm by kubin

» GIUP DO XAY DUNG BO GO TIENG VIET CODE C#
Button - II EmptySun Jul 24, 2011 8:40 pm by phonui82

» CHÀO TẤT CẢ CÁC THÀNH VIÊN TRONG DIỄN ĐÀN
Button - II EmptyTue Jul 19, 2011 9:28 am by phonui82

Đăng Nhập

Quên mật khẩu



April 2024
MonTueWedThuFriSatSun
1234567
891011121314
15161718192021
22232425262728
2930     

Calendar Calendar


You are not connected. Please login or register

Button - II

Go down  Thông điệp [Trang 1 trong tổng số 1 trang]

1Button - II Empty Button - II Tue Feb 16, 2010 9:36 pm

Tesulakata

Tesulakata
Thành viên
Thành viên

How to: Call a Button's Click Event Programmatically


Even if a user does not click a button, you can raise the button's Click event programmatically by using the PerformClick method. The following example demonstrates how to call the click event of a button within a program. When button2 is clicked, the click event for button1 is also triggered.

To use buttons in a program
On the File menu, click New Project.

In the New Project dialog box, in the Templates pane, click Windows Forms Application, and then click OK.

A new Windows Forms project opens.

From the Toolbox, drag two Button controls onto the form.

In the form, double-click the first button (button1) to create the Click event handler.

In the button1_Click event handler, type the following line of code.


Code:
MessageBox.Show("button1.Click was raised.");


Right-click the code, and then click View Designer.

Double-click the second button (button2) to create the Click event handler.

In the button2_Click event handler, type the following line of code.
Code:
button1.PerformClick();



Press F5 to run the program.

The program starts and the form appears. When you click either button1 or button2, the click event handler of button1 displays a message.

https://programmer.4umer.com

Về Đầu Trang  Thông điệp [Trang 1 trong tổng số 1 trang]

Permissions in this forum:
Bạn không có quyền trả lời bài viết