| This tutorial was created with Microsoft Visual Studio | | | | Let's start with the statusstrip label. We will change the |
| .NET 2008. However, if you are using 2005, you can | | | | text on hover and leave of each of the buttons to let |
| implement LINQ by downloading Microsoft's LINQ | | | | the user know what each of the buttons does:private |
| Community Technology Preview release from here. | | | | void button1_MouseHover(object sender, EventArgs |
| In this tutorial, we will be looking at using LINQ to | | | | e) |
| Objects. We will be creating a Windows Forms | | | | { toolStripStatusLabel1.Text = "Display all numbers in |
| Application that will first define an array of numbers, | | | | array"; }private void button1_MouseLeave(object |
| and then we will use LINQ to Objects to interact with | | | | sender, EventArgs e) |
| this collection of numbers. We will create buttons to | | | | { toolStripStatusLabel1.Text = ""; }private void |
| display the results of calculations of the numbers, | | | | button3_MouseHover(object sender, EventArgs e) |
| demonstrating the built-in functions of LINQ, that we | | | | { toolStripStatusLabel1.Text = "Get SUM of all |
| can perform on most any collection. | | | | numbers"; }private void button3_MouseLeave(object |
| We will start by designing our form with Four buttons | | | | sender, EventArgs e) |
| and a label. The first button will be to display all the | | | | { toolStripStatusLabel1.Text = ""; }private void |
| numbers in our array, which we will hard-code for this | | | | button2_MouseHover(object sender, EventArgs e) |
| example. The label will be to show the results of our | | | | { toolStripStatusLabel1.Text = "Get numbers less than |
| functions, and then the other three buttons we will use | | | | 10"; }private void button2_MouseLeave(object sender, |
| for LINQ functions. | | | | EventArgs e) |
| We will also implement a StatusStrip control to make | | | | { toolStripStatusLabel1.Text = ""; }private void |
| use of the label within, so that we can manipulate it on | | | | button4_MouseHover(object sender, EventArgs e) |
| the mouse hover and leave events. The form may | | | | { toolStripStatusLabel1.Text = "Get average of |
| look something like this: | | | | numbers"; }private void button4_MouseLeave(object |
| | | | sender, EventArgs e) |
| Once we are done with our form, we can double-click | | | | { toolStripStatusLabel1.Text = ""; } |
| on the buttons in design view to create the click event | | | | Next, we will create a method that will create an array |
| handlers. We can also create the hover and leave | | | | of numbers that we can call from all of the buttons: |
| handlers by clicking on the Events button in the | | | | You can review the rest of the articlie at Happy |
| Properties window, and then double-clicking on both of | | | | coding! |
| the MouseHover and MouseLeave events. | | | | |