كيف اختار الحدث في السي #
مثل الحدث الرئيسي للزر هو click كيف اختار حدث اخر
كيف اختار الحدث في السي #
مثل الحدث الرئيسي للزر هو click كيف اختار حدث اخر
Hello Mimi,
There are many events for each object especially objects used in Windows and Web Forms.
To find all events for a class check the .NET SDK .For example the Button class has these events:
now you need to specify the event handler.Event handler is the method which you want to be called or executed when the event happens.
to specify an event handler for the event Click of a button called Button1 you write :
Button1.Click += new System.EventHandler(ButtonClickHandler);
This will tell the run time environment that the method ButtonClickHandler must be called when the user clicks the button.
Now you can code the ButtonClickHandler:
private void ButtonClickHandler(object sender, System.EventArgs e)
{
put you code here
}Tahiyati
Madani
هناك طريقة أسهل أخ mimi
أختر الزر أو الأداة التي تريد إضافة الحدث لها ثم في نافذة الخصائص اختر الزر Events ، فتظهر لك أحداث هذه الأداة ، انقر مرتين على الحدث الذي تريده فيظهر لك محرر الكود مع الحدث الجديد الذي أخترته
مشكورين شباب وماتقصرون
هذا الموضوع مغلق.