Entries:
Comments:
Posts:

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

Understanding Event Driven Programming - 23

Embed code for this video

Copy the code above to embed our video on your website/blog.

Close

Video format

Option selected may change based on video formats available and browser capability.

Close

Download

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.

Tags:

Follow the Discussion

  • 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

  • @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:

    http://msdn.microsoft.com/en-us/library/ms178472.aspx

    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 ?

    Thanks.

  • 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!

    Regards,
    Pat.

  • 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?

Remove this comment

Remove this thread

close

Comment on the Post

Already have a Channel 9 account? Please sign in