Loading user information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading user information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Content Obsolete

This content is no longer current. We recommend you try the following url for more up to date content: http://channel9.msdn.com/Series/C-Fundamentals-for-Absolute-Beginners

Understanding Event Driven Programming - 23

14 minutes, 53 seconds


Right click “Save as…”

In this lesson we demonstrate how events are utilized in the .NET Framework Class Library specific to WPF and ASP.NET Web Forms applications. In these examples, we see how C# is generated by the IDE to "wire up" a user action or application event to the code that handles that event. The point is that there's a pattern to how .NET works with events and how events drive most Graphical User Interface based applications.


Follow the discussion

  • Oops, something didn't work.

    Getting subscription
    Subscribe to this conversation
  • Asghar SaidAsghar Said

    Very helpfula and very useful for learner

  • EricEric

    Somethings wrong with this video about 6:10 into it. It fades out and fades back in.

  • @Eric: Yeah, that's weird.  Hmm ... bad editing on my part.  Will look at fixing that ASAP.  Sorry!

  • Not to be fussy, but does not the ReadLine(); command count as an "event" as well? Just wondering when you say that the startup has been the only event so far? Am I mis-understanding this as also being an event?

  • @TheDuc: Good thought, but typically an event has a handler as explained in this video.  The ReadLine() is more of a line of code that blocks code execution until it receives input from the user.  If we had a method that handled onReadLine() that might indeed qualify.  Again, good thinking ... just not exactly what we mean by events in this context.

  • DIvyanshDIvyansh

    Thanks For Bob For such Informative series...

  • DivyanshDivyansh

    Thanks For Bob For such Informative series...

  • BrettBrett

    Bob, Thanks so much for this great series. Really enjoyed it. I wish you the best!

  • @DIvyansh: Thank you!

    @Brett: Thank you, I'm glad you enjoyed it.  All the best!

  • Another great vid from Bob Tabor.

  • DanDan

    Thank you! This was something I had sort of understood but you simplified it enough to make it "click".

    Is there priority or is first come first served? Can a priority be set?


  • @Dan:

    Is there priority or is first come first served? Can a priority be set?

    The order of events is preset by each API (i.e., ASP.NET, WPF, etc.)  Here's one of the most useful pages on MSDN for ASP.NET in particular:


    re: WPF ... I'm not aware of an equivalent explanation, however I know its out there.  You could always just write a simple message to a listbox for every event possible, then watch the order in which they fire.  That's a fun (and educational) way to spend an afternoon.  Cheers!

  • EugeneEugene

    In the middle the video fades and is overlapping with another video. I see this problem was spotted back in Dec 2011.

  • @Eugene: Thank you, yes, it was an editing mistake on my part.  At this point, I'm not sure we'll fix it.  Just being honest ... it lasts for like 2 seconds and would take a combined 2 or 3 hours to fix (if you count all the hands that would need to touch it, not the least of which, *mine*.)  Thank you for pointing it out and hope you are enjoying the series.

  • BillBill

    Video faded out around 6min and left me thinking What?, This seemed like a very hurried very thin explanation and left me thinking, What? Where? Why?....

  • @Bill: Just to clarify, assuming you ignored the fade out @6 minutes (an editing mistake on my part) did the REMAINDER of the video make sense, or did you feel that the ENTIRE video left you wondering What?  Where?  Why?  You were only confused for like 5 seconds, right?  Again, just wanted to get some clarification on this.  Thank you!

  • RickRick

    Like a couple of other posters, I got a bit confused when video faded out. When it came back, it appears some work was done in between (in the property window) to get Hello World to show up in the text block. But when I attempt to type the command I subsequetnly see on screen ( I think method two), I get error saying textblock1 is unknown.

  • Jon ChapmanJon Chapman

    Hi, first time posting. Great video series, thank you, Bob! Very concise and well demonstrated throughout, particularly the IDE features.

    Regarding the break 6:20 minutes in, I thought I would share how to get past this if you are coding along to the video. It's very simple and I'm sure most people have figured it out already, but what you must do is scroll to the 'Click' event in the button event list, and write in "button1_Click" into the text box beside the event type, and hit ENTER. This will fill in the new event for you. Then simply write in the textBlock1.Text = "Hello World!"; line into the new block. textBlock1 is the default name of the text block added before the button earlier in the video (you can see and change the text block name in its properties if you click on it).

  • Alex YeomanAlex Yeoman

    Fantastic video series, clearly explained and easy to follow. Still plenty to get my head around but well on my way now. Thanks very much!

  • MaoMao

    I am using Visual Studio express 2010. In your Vidio 3&#58;20, you asked us to double click the &#34;MainWindow&#34;. I followed the instruction but nothing happen in the .cs code. Is there other way I can create the event. Is it because I am using Visual studio express&#63;<br><br>THank you very much for your very helpful video

  • tejateja

    thanks bob your lessons help me alot,i want to know hot to create a databound application making and using a database.where can i found such things .Thanks in advance

  • Thank you so much Bob! These videos have been great! It is nice to see someone take their time to produce such quality content as you do. Will you by any chance continue these lessons on a "intermediate" level?

  • @Mao: That should work.  Another option ... Properties window, change to the Events "tab" / button ... find the event you want to create and either double-click the event name on the left OR type in the event / method name you want to create.

    @teja: I have those on my own personal website, http://www.learnvisualstudio.net

    @FrederikNorlyk: Thank you!  In your mind, what does "intermediate" mean?

  • Vineeth RVineeth R

    Hi Bob,

    I have a small doubt. In an earlier episode, you showed us how to compile console programs without using Visual Studio IDE (the one where you used csc.exe located in C:\Windows\Microsoft.NET\Framework\v4.0.30319\).
    Is this method specific to compiling console applications? If so, is there any other similar method to compile codes which utilizes WPF without using Visual Studio IDE?

  • @Vineeth R: The compiler is THE compiler -- Visual Studio even uses it behind the scenes.  While I don't know the specific commands needed to compile a WPF app off the top of my head, I do know that your C# project file is basically just an MSBuild configuration file which can be used to automate compilation.

  • UshaUsha

    Hi Bob,

    Thanks for the wonderful series of videos. There's a problem with this video which has not been fixed yet and it is causing some confusion to a beginner like me. Could you please tell us what was the part that vanished in the video?

  • DonDon

    Hi Bob,

    Thank You very much for the very clear video series.
    It really kicks me in the right direction.
    However I want to start with VS2012 (studio express for desktop) and tried to build an WPF application. However I cannot add a "Window_Loaded" event handler by double clicking the main window outer edge as showed in the video.
    Manually adding the code and adding the Loaded="Window_Loaded" in the xaml file will get things to work. But i want to understand why this doesn't work in VS2012.

    What am I missing ?


  • ZaroorZaroor

    Very Useful video for all its great full if you can show Database programing with c#

  • Patrick BellPatrick Bell

    Hi Bob,

    Thank you very much for these lessons! I was shortlisted for a local government developer job and I had not long finished my BA in Info Tech. I had forgotten a lot of the basic syntax and concepts as my time was spent mostly designing and developing in the web space. These videos have helped not only with refreshing my understanding of .NET and C#, but also with getting me a well-paid job!


  • JokemJokem

    Don -
    Are you still there?
    I am having the same problem and wondered if you had found a resolution?

  • Hi Bob, Thx for these lessons, I'm brand new in c# and have the book beginning c# programming 2012, and some of it gives med gray hair, but after watching your lessons, it's getting easier.

    Keep up the good work Smiley 


    All the best from Denmark

    Lucas - alias Sacul.   

  • JokemJokem

    sacul -

    I don't think Bob is reviewing this web page anymore.

    For lesson 23 VS 2012 has confusing differences.

    I managed to get the window loaded reference in by

    inserting Loaded="Window_Loaded" right after the width

    statement in the xaml. That automatically put in the

    'private void' stuff. The rest I can't get to work.

  • JokemJokem

    Here is what I think is missing from the video.

    Click the TextBlock on the xaml screen.

    Press f4 for properties.

    Enter TextBlock1 for the name.

    Click the first button.

    f4 for the properties screen

    Enter Button1 for the Name

    go to click and enter Button1_click in the box there

    Double click inside the box and it should pop you to the
    C# code for that.

  • The videos are great, but this last one is throwing some unusual outcomes due to possible versions of visual studio.

    I notice when I add the second button and go to the main code and enter the Button2.Click, then the += sign, I don't get the new RouteEventHandler(Button2_Click) but Button2_Click only. If I do the tab twice, my sub code shows a throw new NotImplementedException rather than what Bob shows to get. Is there a difference in the Intellisence for Visual Studio Ultimate 2012 verses the Visual Studio 2010 Express?

  • For anyone with VS2012, a few issues with this video that I'm having:

    - Double clicking the MainWindow doesn't auto insert the event.  I added the event by clicking on the MainWindow, then using the event view (clicking on the lightning bolt) in the Properties window, finding "Loaded" and typing "Window_Loaded" in the field to the right.

    - TextBoxes and buttons aren't automatically named "button1", "textBlock1", etc.  You have to do this manually by clicking on the object and in the properties window where it says "Name", you replace "<No Name>" with the appropriate name.

    - button2.Click+= and tab tab doesn't work.  I just manually typed everything that was on the screen.

    I'll add more if I run into more of these quirks.

  • For those using VS2012, for the ASP.NET portion, there is no "ASP.NET Web Application" option in VS2012.  Select "ASP.NET Web Forms Application".

  • AlexAlex

    As this was the last main video in this series which I have enjoyed and found very useful, I was thinking of going over to your website and signing up for more.

    The fade in the middle of the video leaves me unsure how you hooked up the on click or whatever even you did. At such a pivotal point in the video, where the main concept is being explained a break like this is just ridiculous. It makes the whole video pointless.

    I was encouraged to see your comment saying that you would have it fixed. Your somewhat arrogant response later on saying you won't, has lost you this subscriber, and who knows how many others who couldn't be bothered to take the time to comment... makes those 2 or 3 hours seem relatively insignificant.

  • Clint RutkasClint I'm a "developer"

    @Alex: sorry you feel that way.  Bob did a great job, trying to do a 40 hours worth of content takes a lot of time and it is extremely hard to get it 100% perfect.  There will always be areas for improvement. 

    Doing a video takes many takes and even then, it may not be perfect.

    We try our best to respond to questions as well.

  • dinhquocdinhquoc

    Hi Bob,
    You can share file .pdf of this series for me?
    Mail: dinhquoc04b@gmail.com

  • Clint RutkasClint I'm a "developer"

    @dinhquoc: sorry, we don't have one for this.  The WP8 beginner series was the first time we created one.  Doing the PDFs, while amazing, do add in a lot of extra time to create and effort.

  • thanks for the help, theonlymember!  this really helped me as I was really struggling through this video as nothing I was doing was behaving according to the video.

    Just to clarify the names for the buttons and textboxes.  when you click on the TextBlock in the MainWindow.xaml, you will see its properties on the righthand side under Properties.  By default, next to Name, it is blank.  You need to type in textBlock1 for Bob's code to work.

  • Interesting topics and videos, thank you so much for sharing those with us, I am still a English learner, So, may be you can be my teacher, not only C#, but also English, thanks again.

  • NovitaNovita

    is it only me or the video isn't working properly ._.
    I only hear the audio

  • Clint RutkasClint I'm a "developer"

    @Novita:plays for me.  Try downloading them if you have issues.

  • Hi Bob, Awseome series.
    On question: If I want to edit the design of the Label 3 (Hello World from button 3), how would I do? Let´s say that I want to change the Font and the Color, can I do this through C#?

    Many thanks  


  • EhsanEhsan

    That's so Great Bob, the way u explain the concepts irrespective of the level of ur viewer. God Bless You!

  • pslymr robertpslymr robert

    Hi! Ilyk dis page. But if any one who knows the validation code please send to me

  • TamirTamir

    Hi Bob,
    It's been nearly 2 years since your comment about fixing the editing problem in the video about 6:10 in to it...
    Well it's still there...

    Anyway your videos are great! They realy helped me, though I learned some C# in school before that.
    Looking forward to learn how to develop apps for Windows Phone 8 with the help off your great videos!

    Tamir. :)

  • David JeterDavid Jeter


    1. I have typed all your programs!! but when I saved and exit them then try to reload I get the program loads but, a blank program code!!!!!

    2. I have no program box in the lower right corner of my open coding window!!!!!!!!

    3. I have no toolbar like on video 23????

    I enjoyed your videos ok

    thanks DAVID JETER

Remove this comment

Remove this thread


Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.