Understanding of events and entrusted (4)

xiaoxiao2021-03-06  82

By studying the knowledge of the relevant chapters related to the events and the relevant chapter in MSDN, there is a preliminary understanding of the event, commission, event data, event link, and incident. By the way, Dongdong in MDSN is really great, many times They are all riding a little, and they can find them in MDSN. Learn to have a little hard, but learning should be a happy thing. Because you can concentrate, understand and digest the knowledge in MSDN , Then turn them into your own things, you will grow up in your study. Say it back. I know by preliminary learning: EventHandler is a commission, declare: Public Delegate EventNameHandler (s as object, e as eventargs: is an event data class that can override the EventArgs class to override the event data classes you need, and then use it in the relevant delegate. Event is implemented by Event: Public Event Click As EventHandler To successfully respond to events, the signature of the event response program must be the same as the signature of the corresponding event, that is, I do a user control in the actual programming work, used in a system The data is displayed, and the user needs to implement the corresponding delete and editing operation after the specified record clicks, and the system is handled by the user controls because of the different modules, so I need to be in the user control. Declare an event to send a message to the parent form that calls it, and the event's response is placed in the event response function of the parent form, and it is connected via the Handler. So I need the first step: declaration in the user control an event, and the preparation of related events trigger the code public class databrower .... delegate editRecordEventHandler (s as object, e as System.Web.UI.WebControls.DataGridCommandEventArgs) public event EditRecordClick as editrecordeventhandler ..... private sub DataGrid_ItemCommand ( S as object, e as system.web.ui.webcontrols.dataGridcommandeventargs) Handler DataGrid.Itemcomcom Mand Rainsevent EditReoCrdClick (s, e) End Sub ... End Class Second: Writing Event Processing Functions in the Parent window ..... Private Sub DataBrower_EditRecordClick (s AS Object, e as system.web.ui.webcontrols. DataGridCommandeventargs) Handler DataBrower.editRecordClick ... End Sub .....

转载请注明原文地址:https://www.9cbs.com/read-104555.html

New Post(0)