1 00:00:01,020 --> 00:00:08,280 In this lecture I will show you the proper way to rename an event handler method. 2 00:00:08,450 --> 00:00:14,580 In that previous like show we renamed one of our event handlers and if you don't do that properly you 3 00:00:14,580 --> 00:00:16,570 can run into errors. 4 00:00:16,600 --> 00:00:20,560 So I'm just gonna show you the right way to do that. 5 00:00:20,850 --> 00:00:33,020 We in our last lecture we created an event handler which is which originally was the mouse down. 6 00:00:33,060 --> 00:00:41,280 So if I click on this picture box and click on this make sure you've got this events highlighted. 7 00:00:41,940 --> 00:00:51,030 If I scrolled down to the mouse down this was the original event handler we created. 8 00:00:52,200 --> 00:01:01,230 So when you double click on that it will generate a code to reflect the name of that event. 9 00:01:01,230 --> 00:01:04,590 So initially it had mouse down. 10 00:01:05,430 --> 00:01:11,970 So if I go here too Initially this force picture books one on the school mouse down. 11 00:01:11,970 --> 00:01:14,400 If you change it from here 12 00:01:17,010 --> 00:01:19,800 you will run into problems later. 13 00:01:19,830 --> 00:01:22,710 The best way to change it is from the design. 14 00:01:22,710 --> 00:01:27,990 Here you come here from the original one. 15 00:01:28,070 --> 00:01:36,030 This is where you change it so ways go the mouse down you changed it down to a click and then you go 16 00:01:36,030 --> 00:01:39,060 back into your code view. 17 00:01:39,060 --> 00:01:44,110 If that doesn't change then you can manually change it down to the click. 18 00:01:44,310 --> 00:01:47,520 And that way you should be able to compile the code. 19 00:01:47,910 --> 00:01:54,040 If you change it in one and not the other you may run into problems. 20 00:01:54,060 --> 00:02:01,680 Also I mentioned the reason why I changed the event handler name from the mouse down to mouse click 21 00:02:01,830 --> 00:02:05,330 it's because I wanted this method. 22 00:02:05,340 --> 00:02:13,340 This from this code I've written for this method to be used by the mouse up key as well. 23 00:02:14,100 --> 00:02:22,560 So to achieve that way I would have gone right to the event I need to look for the event. 24 00:02:22,590 --> 00:02:27,740 So where you've got a mouse up there's a dropdown where you can select event. 25 00:02:27,840 --> 00:02:30,880 I have added this mouse click event. 26 00:02:31,320 --> 00:02:37,920 So that means the code writing for this mouse click will now work for the mouse up as well. 27 00:02:37,920 --> 00:02:45,210 So all you have to do is just for example if I wanted to do one for a mouse move or mouse leave you'd 28 00:02:45,250 --> 00:02:52,110 double click on if you'd drop down to tell you give you a list of all the events that's already available 29 00:02:52,530 --> 00:02:58,310 so you can choose which one for example this one here the dropdown for click on the dropdown euro or 30 00:02:58,320 --> 00:03:02,190 the already has this because I've already attached it. 31 00:03:02,190 --> 00:03:02,730 All right. 32 00:03:03,000 --> 00:03:07,440 So that's how you rename a method. 33 00:03:08,300 --> 00:03:08,720 OK. 34 00:03:08,730 --> 00:03:09,720 That's the proper way. 35 00:03:09,750 --> 00:03:13,640 If you don't do a right you generate a lot of arrows here. 36 00:03:13,800 --> 00:03:18,190 And when you try to compile Visual Studio will complain. 37 00:03:18,300 --> 00:03:20,340 So that's it for this lecture. 38 00:03:20,340 --> 00:03:21,660 Thanks so much for watching. 39 00:03:21,660 --> 00:03:22,230 Bye for now.