Are These Two Event Handler Examples Equivalent?

I have found 2 examples of adding an event handler in C#.  The even handler is (obviously) the method named b2_FlashProgressChanged.  Are both of these two forms valid and equivalent?
BackgroundWorker bw = new BackgroundWorker();
bw.ProgressChanged += bw_FlashProgressChanged;
bw.ProgressChanged += new ProgressChangedEventHandler(this.bw_FlashProgressChanged);
private void bw_FlashProgressChanged(object sender, ProgressChangedEventArgs e)
MCSD .NET developer in Dallas, Texas

Yes. In the initial releases of C# the compiler could not infer the type of a method given just its name so you had to explicitly wrap it in event handler. But a long time back the compiler was updated to allow for type inferencing such that the compiler
can verify that a method name matches the signature of a delegate and therefore does not need the explicit conversion anymore. You should prefer the first syntax when possible as it is less typing and easier to read IMO.
Michael Taylor
http://blogs.msmvps.com/p3net

Similar Messages

  • Two event handler

    I am using two event handler
        CLASS-METHODS:
            handle_data_changed_finished
                FOR EVENT data_changed_finished OF cl_gui_alv_grid
                    IMPORTING e_modified
                              et_good_cells.
        CLASS-METHODS: catch_doubleclick
               FOR EVENT double_click OF cl_gui_alv_grid
               IMPORTING e_column   es_row_no sender.
    And after I call them like that 
        SET HANDLER ci_events_grid->handle_data_changed_finished
                FOR ci_grid .
        CALL METHOD ci_grid->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_enter.
       SET HANDLER ci_events_grid->catch_doubleclick FOR ci_grid.
    There is a problem that when the changes finish on grid , it can handels handle_data_changed_finished
    truely but when the user double click it couldnt gets true row id .
    But when I do not use handle_data_changed_finished method there wasnt problem occurs ,
    How can I use two methods together ?

    No I dont catch with user-command
    Please below the code method implementations.
          CLASS lcl_event_receiver IMPLEMENTATION
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_data_changed_finished.
        PERFORM data_changed_finished TABLES et_good_cells.
    ENDMETHOD.                    "HANDLE_DATA_CHANGED_FINISHED
      METHOD catch_doubleclick .
        IF e_column-fieldname NE 'REASON_ICON'.
          EXIT.
        ENDIF.
        READ TABLE gt_itab  INDEX es_row_no-row_id INTO gt_ch_itab.
        CASE e_column.
          WHEN 'REASON_ICON'.
            IF gt_ch_itab-changed = 'X'.
              CALL SCREEN 200 STARTING AT 40 8
                            ENDING AT 80 20.
            ENDIF.
        ENDCASE.
      ENDMETHOD.                    "handle_double_click
    ENDCLASS.                    "LCL_EVENT_RECEIVER IMPLEMENTATION
    FORM data_changed_finished  TABLES et_good_cells STRUCTURE lvc_s_modi.
      DATA ls_good_cells TYPE lvc_s_modi.
      LOOP AT et_good_cells INTO ls_good_cells.
        AT NEW row_id.
          READ TABLE gt_itab INDEX ls_good_cells-row_id.
          IF sy-subrc = 0.
            IF gt_itab-pwmt1   NE gt_itab-old_pwmt1 OR
               gt_itab-pwtt1   NE gt_itab-old_pwtt1 OR
               gt_itab-dlvcnt  NE gt_itab-old_dlvcnt.
              gt_itab-changed        = 'X'.
              gt_itab-status         = icon_led_yellow.
             gt_itab-reason_icon    = icon_system_help.
            ELSE.
              CLEAR : gt_itab-changed,gt_itab-status.
            ENDIF.
            MODIFY gt_itab INDEX ls_good_cells-row_id.
          ENDIF.
        ENDAT.
      ENDLOOP.
      CALL METHOD ci_grid->refresh_table_display
        EXPORTING
          i_soft_refresh = 'X'.
    ENDFORM.                    " data_changed_finished

  • Hi, my current plans and products include Creative Cloud Photography plan (one-year) and Creative Cloud single-app membership for Photoshop (one-year), I only use photoshop occasionally and for very basic things, are these two plans required for basic p

    Hi, my current plans and products include Creative Cloud Photography plan (one-year) and Creative Cloud single-app membership for Photoshop (one-year), I only use photoshop occasionally and for very basic things, are these two plans required for basic photoshop use or am I able to go with one or the other ?

    PS is part of the photography plan, so your single app plan is redundant.
    Mylenium

  • Having just bought an iMac and set every thing up I have found that my IPad seems to run very slow. I have also just updated the IPad to OS 5.1 .Are these two things connected or is there a problem with the IPad

    Having just bought an iMac and set every thing up I have found that my IPad seems to run very slow. I have also just updated the IPad to OS 5.1 .Are these two things connected or is there a problem with the IPad

    Using the Mac with your iPad has nothing to do with the fact that the iPad is running slow. There could be any number of reasons why the iPad is now running slow.
    Have you tried a reset on the iPad?
    Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.

  • While travelling in the U.S.A I purchased an app store card for my IPOD which was bought in Canada.  I am having trouble redeeming the card on my IPOD, it is coming up not valid.  Are these two items compatible?

    While travelling in the US I purchased and app store card for my IPOD touch which was bought in Canada.  I am have trouble reddeming the card on my IPOD.  Are these two items compatible?

    Gift cards can only be used in the App/iTunes store in the country in which they were purchased. You can only purchase items from the store of the country you are physically located.

  • Jsp inputfield - Event Handling examples

    Hi,
    Can someone please tell me how to handle an event for jsp inputField
    The same way how we do it for button ... I want to know some   event based attributes for inputfield
    Thanks,
    Sandeep

    Hi,
      Can u please close these threads appropriately. I think my answer gave u the solution. Please mark the answer as 'Problem Solved'.
    JspDynPage - JspDynPage Communication ???
    Program Flow using response.write(" "); ???
    For this question, there are no standard events for input field like button or any other control. But u can try with onFocus or onBlur etc. I will try to get u some example.
    Regards,
    Harini S

  • Simply question: Are these two query same?

    Question 1:
    There is this query from someone: (I'm not sure how Join ON works)
    SELECT NULL AS order_id
    ,line_id
    ,o.item_id
    ,o.customer_id
    INTO v_line_table
    FROM xx_items_v i,
    JOIN order_dtl o ON i.item_id = o.item_id
    WHERE o.que_id = 3380;
    Is this same as below?
    SELECT ORDER_ID , line_id , o.item_id, o.customer_id
    into v_line_table
    FROM xx_items_v i, order_dtl o
    where i.item_id = o.item_id (+)
    and o.que_id = 3380;
    Question 2:
    I want to retrieve ORDER_ID information from a 3rd table (order_header.order_id). The key between order_dtl & order_header are que_id. How can I add to the first query above?

    No. Your first query will never work it has a comma between the first table and the join key word remove it then...
    remove the (+) from you second piece of code and it will be the same as the amended first piece of code, or turn the upper piece of code into an outer join by specifying whether it is a left or a right outer join.
    In your case it's a left join:
    select [column list]
    from table1 i
    left join table2 o on i.key = o.key
    where o.column = 1234;However, the where clause turns this query back into an inner join becuase the right side of the join must exist. You can either allow o.column to be null in the where clause, or move the predicate up into the join. The two folowing queries are equivalent in their results:
    select [column list]
    from table1 i
    left join table2 o on i.key = o.key
    where o.column = 1234
    or o.column is null;
    select [column list]
    from table1 i
    left join table2 o on i.key = o.key and o.column = 1234;Message was edited by:
    Sentinel

  • What are these two new songs? (hip hop)

    Just this week for the first time I've heard two songs I've never heard before on the radio. All I can remember is the hook from each of them.
    One of them often says "Ridin on three" and the other says "Do you wanna pimp mista". Does anyone know which songs these are? Thanks!
    AMD   Windows 2000  

    I didn't know someone else's lyric query got answered on here, but regardless, I don't think this forum was meant for that.
    I will suggest these four websites
    http://lyricsworld.com
    http://wowlyrics.com
    http://letssingit.com
    http://azlyrics.com
    as good lyric websites, in which you can search for a lyric. Of course, there are more, I just can't find anymore right now.
      Windows XP  
      Windows XP  

  • I am trying to download photos stored on a memory stick to my imac, but two of the files are saying unreadable.  Why?  Are these two sets of photos never going to be copied onto my Mac?  If so, how can I get them onto my iphoto folder.  Desperate.  Glen

    I am trying to put photos stored in a memory stick onto my Mac computer.  But there are two folders that will not move.  I get an error message saying - volumes/FLASH DRIVE/desktop. ini - can someone help me please?  The photos are from my windows computer.  Please answer back assuming I am a total drip - I am a lot older than you I should imagine !!  Thanks  Glenys

    Can you double click on them on the memory stick, see if preview opens them, then save them to your Mac?
    ...JER

  • I downloaded the upgrade for fire fox, now I am having trouble with youtube, are these two things related? Something about an embeded code.

    My system won't restore so I don't know if the two are related. You tube has a code to copy past, but it just says paste to 'your web page or blog' Any ideas?

    Clear the cache and the cookies from sites that cause problems.
    * "Clear the Cache": Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    * "Remove the Cookies" from sites causing problems: Tools > Options > Privacy > Cookies: "Show Cookies"

  • Are these two methods equivilent ways to download flash player 10.0.32.18?

    I use Vista with Vista Service Pack 2 and IE7 browser
    by going and downloading from
    http://get.adobe.com/flashplayer/?promoid=BUIGP
    OR
    going and downloading from
    http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player_ax .exe.
    will both methods give me the same flashplayer 10.0.32.18 with the same functionality AND security?

    A few clarifying questions if nobody minds
    1. which one is the online installer?
    2.  which one is the offline installer?
    3. What is the difference between the two?
    4. Are they equally as safe and secure, in downloading and in functionality?
    5. During this time period, I went ahead and did the following (which I have read others do):
        I went to a trusted website that required flash player 10.0.32.18
        As I had no flash player installed, i got the message
                 "this site might require the following Active X control: Adobe Flash player Installer from ADOBE systems inc"
       When I right clicked on that it said "click here to install"
        Then a window popped up that said
       " Do you want to install this software?"
        name: Adobe Flash Player Installer
        publisher "Adobe Systems Inc"
       I clicked the install button and I have flash player ability
    ( in my browser under tools/internet option/settings/ view files it shows this
    fpdownload2.macromedia.com.get/shockwave/cabs/flash/swflash.cab)
    6. So this method I outlined using the "offline installer"
    7. From the looks of it all with this method, do I have the correct and secure version of flash player10?
    When I check my add/remove programs from the Vista Control Panel it shows ADOBE Flash Player 10 Active X version 10.0.32.18
    When I go to a site that has a flash player item and I check "about Adobe Flash player" it shows the current 10.0.32.18 version

  • What are these two powerbooks worth roughly?

    I have a 15" 1.67 low res power book, here are some basic stats
    1gb memory, 80 gb hd, 10.5.7. MS office, then all standard.
    Excellent condition. No issues whatsover, great screen.
    And a customer wants to trade some of my labor for this one
    15" 1.5 power book
    512 mb ram, 80 gb, I think its running leopard, has MS office, needs charger (no big deal, can get one on ebay)
    Im thinking about taking the labor trade (for a couple hundred off the bill), and selling both on ebay or maybe craigslist. Then getting a high res (maybe 17") or maybe macbook pro.
    Anyone been paying attention to what they're worth? Are the High res models that much better? Should I get a Pro?
    Thanks

    The high-res models are better in that they are the last ones Apple made and have all the bugs and such worked out of them. Also, the screen resolution is a huge PLUS.
    I got a 15-inch 1.5GHz on eBay and after doing some tests, realized I'd have more space with the high-res 1.67GHz model and improved specs like faster RAM and a Double-Layer SuperDrive.
    So, I did get that 1.67GHz model and sold the 1.5GHz to my friend.
    Of course, I've since upgraded to a MacBook Pro unibody (Late 2008). It's all up to you and based on your, one, needs and work, and two, your budget. You can even get an older MacBook Pro which would be a huge bump over your PowerBook G4.

  • What are these two settings in the "Advanced" tab?

    Hello,
    So I've recently cleaned out my library (deleted duplicated tracks and tracks that I don't like anymore), after doing so I've consolidated them. I did that to delete the BIG folders of music I had on my hard drive (because when I delete from iTunes and the track isn't consolidated, the track is still on the hard drive). Now, what do I do to have iTunes consolidate every track I add to my library?
    And what is the difference between "Keep iTunes Media folder organized" and "Copy files to iTunes Media folder when adding to library"? And do they do?
    I tried reading the little "description" and that just confused me even more.
    Thanks if you're able to help me out.

    Here's a pretty good explanation of what those two options do:
    http://www.informit.com/articles/article.aspx?p=473851&seqNum=5
    what do I do to have iTunes consolidate every track I add to my library?
    What precisely to you mean by "consolidate"? If you want iTunes to keep things organized and in it's own folder, checkmark those two options. Then iTunes will keep everything neatly in the iTunes folder, and once added you can delete any extra copies.
    Hope this helps.

  • Do I have to buy a special cord to connect my new ipod touch with my new ipad? or are these two not compatible? Trying to get all my music from touch to ipad...

    Do I have to buy a special cord to connect my new Ipod Touch with my new Ipad? I synced the new touch with my previous nano, but how do I get all my music on my ipad??

    Cynthia422 wrote:
    Do I have to buy a special cord to connect my new Ipod Touch with my new Ipad? ...
    Do not connect the Devices... is not advisable nor how it is done.
    Cynthia422 wrote:
    ... how do I get all my music on my ipad??
    The Sync Process is via iTunes...
    See here  >  http://support.apple.com/kb/HT1386
    From Here  >  http://www.apple.com/support/iphone/syncing/

  • Have Audigy2 in Vista, why are there two volume control icons in system tr

    Hi,
    I'm running an Audigy2 on a Windows Vista system. There are two volume control icons in the system tray. One is the Soundblaster control, the other is the Windows control.
    Are these two programs supposed to be running at the same time? Do they conflict with one another?
    Thanks for your time,
    Big Al Mintaka

    Hi pgaastra.  I don't know why there are two items in the task bar, but you have identified the
    recommended fix.  The why never bothered me enough to investigate, so maybe we will both
    find out now.
    Matt
    Message Edited by Matthew Williams on 04-16-2008 08:49 PM

Maybe you are looking for

  • How can I display three images in video rate succession (60 Hz)?

    For a structured illumination microscope application, I have developed a VI that creates three images and displays them in rapid succession (as fast as the loop will go) on a second monitor. From the naked eye it's pretty apparent that the loop is no

  • Oracle Report6i - Report and Spreadsheet in one rdf file

    Hi ALL, My user wants to have an Oracle report with header, titles etc. and also a CSV file in the same Report or rdf file. I am thinking of using a parameter to select either the Report or the CSV file or both. I know I can do this in 2 different rd

  • Photoshop Elements 5.0 doesn't start after reinstallation

    On my Windows 7 system was PE 5.0 up and running. Due to a system error I needed to Recover the system and afterwards réinstall all programs, including PE 5.0. Th installtion went correct, but the prgram doesn't start I've removed all temp internet f

  • Using a CHECK constraint to check for minimum age

    Is it possible to use a check constraint in a table to check whether a person meets a minimum age? For example, if a person is registering as a member, I want to make sure the person is at least 18 years old (contract age), so that a minor doesn't tr

  • Fwd: Dependencies for AIX6.1

    Hi Technology Consultants, I am installing ECC6.0SR3 with MaxDB7.6 On AIX6.1 (IBM P series Servers). when i was installing Java "IBMJava2-142-ppc64-SDK-1.4.2-13.0.ppc64.rpm" . its not installing and asking for dependencies. Anybody send me the link w