Migrating 'Handles' from VB.NET to C# -
I have some code to VB Migrating from Net to C # (3.5).
I'm getting the structure like:
PublicLink DataLoaded (ByVal as the object, inVal e EventArgs) protected sub Mag_Button_Load_Click (ByVal In the form, byVal E EventArgs) Handle Mag_Button_Load.Click [..] RaiseEvent DataLoaded (I, EventArgs.Empty) End Sub [..] 'Other Classes Private Sub LoadData (ByVal as the object, ByVal e System .AventArgs) Handle oData.DataLoaded [..] End Sub What is the most direct way to translate this kind of behavior to C #?
A start.
C # is not that "Handle" does the keyword like VB.NET.
// EventHandler Announcement Easy hand-drawn event event handler of event handlers through public dataloaded; Protected Zero Mag_Button_Load_Click (Object Sender, EventArgs e) {// Raise Event if (DataLoaded = Null!) {DataLoaded (This, EventArgs.Empty); }} In addition, you must assign your event handler to such an object:
Button1.Click + = Button1_Click; Protected void Button1_Click (Object Sender, EventArgs E) {// Something} While there is a brief capability to do the same with C #:
Button1.Click + = (Sender, E) => {// do something}
Comments
Post a Comment