s WORKING WITH EVENTS in VB.NET

Drawer ECC200 in VB.NET s WORKING WITH EVENTS

CHAPTER 17 s WORKING WITH EVENTS
Print Data Matrix ECC200 In VB.NET
Using Barcode encoder for .NET framework Control to generate, create ECC200 image in Visual Studio .NET applications.
www.OnBarcode.com
ECC200 Scanner In Visual Basic .NET
Using Barcode recognizer for .NET framework Control to read, scan read, scan image in .NET applications.
www.OnBarcode.com
s The MultiLine property of a TextBox can also be set without using the Smart Tag feature. You can Tip
UPC-A Supplement 5 Encoder In VB.NET
Using Barcode creator for VS .NET Control to generate, create UPC-A Supplement 2 image in Visual Studio .NET applications.
www.OnBarcode.com
Generating Linear In VB.NET
Using Barcode encoder for VS .NET Control to generate, create Linear image in VS .NET applications.
www.OnBarcode.com
directly set the MultiLine property to True, which is set to False by default.
Create Data Matrix In VB.NET
Using Barcode generator for Visual Studio .NET Control to generate, create Data Matrix ECC200 image in Visual Studio .NET applications.
www.OnBarcode.com
USS Code 128 Generation In Visual Basic .NET
Using Barcode drawer for .NET Control to generate, create Code128 image in VS .NET applications.
www.OnBarcode.com
6. Drag a Label control from the Toolbox to below the TextBox and set its AutoSize property to False. Also, set the Label s Font Size property to 12 and TextAlign property to MiddleCenter. Now your Events form will look like the one shown in Figure 17-6.
Draw Code 3 Of 9 In Visual Basic .NET
Using Barcode generator for .NET framework Control to generate, create USS Code 39 image in .NET applications.
www.OnBarcode.com
Encoding Code 11 In Visual Basic .NET
Using Barcode encoder for .NET Control to generate, create Code 11 image in .NET framework applications.
www.OnBarcode.com
Figure 17-6. The Events Windows Form with controls 7. Select the TextBox, open the Properties window, and click the Events button. In the events list, double-click in the text area of the MouseEnter and MouseLeave events. This will simply create the event handlers for these two mouse movement events. 8. Switch to Code view and add the following code to the MouseEnter and MouseLeave event handlers: Private Sub TextBox1_MouseEnter(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles TextBox1.MouseEnter Label1.Text = "Mouse Enters into the TextBox" End Sub Private Sub TextBox1_MouseLeave(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles TextBox1.MouseLeave Label1.Text = "Mouse Leaves the TextBox" End Sub 9. Go to the Build menu and click Build Solution; you should receive a message indicating a successful build. 10. Press F5 to run the application. You will now see a message in the Label control depending on the action you perform with your mouse. Move the mouse pointer over the text box, and you ll see the message shown in Figure 17-7.
Draw DataMatrix In .NET Framework
Using Barcode printer for Reporting Service Control to generate, create Data Matrix ECC200 image in Reporting Service applications.
www.OnBarcode.com
Generating Data Matrix ECC200 In Java
Using Barcode printer for Java Control to generate, create Data Matrix 2d barcode image in Java applications.
www.OnBarcode.com
CHAPTER 17 s WORKING WITH EVENTS
PDF417 Generator In Java
Using Barcode generator for Android Control to generate, create PDF-417 2d barcode image in Android applications.
www.OnBarcode.com
Reading Barcode In Java
Using Barcode Control SDK for Java Control to generate, create, read, scan barcode image in Java applications.
www.OnBarcode.com
Figure 17-7. Demonstrating the MouseEnter event 11. Now move the pointer outside of the text box, and you will see the message shown in the Label control change (see Figure 17-8).
Recognize QR In C#.NET
Using Barcode scanner for Visual Studio .NET Control to read, scan read, scan image in VS .NET applications.
www.OnBarcode.com
Reading Barcode In Visual Basic .NET
Using Barcode recognizer for VS .NET Control to read, scan read, scan image in VS .NET applications.
www.OnBarcode.com
Figure 17-8. Demonstrating the MouseLeave event
Printing QR-Code In Java
Using Barcode maker for Java Control to generate, create QR Code ISO/IEC18004 image in Java applications.
www.OnBarcode.com
GS1 128 Drawer In .NET
Using Barcode maker for Reporting Service Control to generate, create GS1 128 image in Reporting Service applications.
www.OnBarcode.com
How It Works
Encoding Barcode In Objective-C
Using Barcode drawer for iPhone Control to generate, create Barcode image in iPhone applications.
www.OnBarcode.com
EAN13 Creator In None
Using Barcode drawer for Online Control to generate, create UPC - 13 image in Online applications.
www.OnBarcode.com
The MouseEnter event will occur when you take the mouse pointer into the text box having the focus, and this will be recognized by the MouseEnter event handler, resulting in the appropriate message being displayed in the Label control. In the same way, when you move the mouse pointer away from the focus of the text box, the MouseLeave event gets into the action, and again the appropriate message is displayed in the Label control.
Barcode Drawer In Objective-C
Using Barcode creator for iPhone Control to generate, create Barcode image in iPhone applications.
www.OnBarcode.com
UPC-A Supplement 2 Printer In None
Using Barcode printer for Online Control to generate, create UPC A image in Online applications.
www.OnBarcode.com
CHAPTER 17 s WORKING WITH EVENTS
Try It Out: Working with the Keyboard s KeyDown and KeyUp Events
In this exercise, you will work with the KeyDown and KeyUp events, which are associated with controls that can receive input from the keyboard whenever a user presses or releases the Alt, Ctrl, or Shift key. To try these events, follow these steps: 1. Navigate to Solution Explorer and open the Events.vb form in Design view. 2. Select the TextBox control, open the Properties window, and click the Events button. In the events list, double-click in the text area of KeyDown event. This will simply create an event handler for the KeyDown event. 3. Switch to Code view and add the following code to the KeyDown event handler: Private Sub TextBox1_KeyDown(ByVal sender As System.Object, _ ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown If e.Alt = True Then Label1.Text = "The Alt key has been pressed" Else If e.Control = True Then Label1.Text = "The Ctrl key has been pressed" Else If e.Shift = True Then Label1.Text = "The Shift key has been pressed" End If End If End If End Sub 4. Switch back to Design view again. Select the TextBox control, open the Properties window, and click the Events button. In the events list, double-click in the text area of the KeyUp event. This will simply create an event handler for the keyboard s KeyUp event. 5. Switch to Code view and add the following code to the KeyUp event handler: Private Sub TextBox1_KeyUp(ByVal sender As System.Object, _ ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyUp If e.Alt = False Or e.Control = False Or e.Shift = False Then Label1.Text = "The Key has been released" End If End Sub 6. Go to the Build menu and click Build Solution; you should see a message indicating a successful build. 7. Press F5 to run the application. Move the mouse pointer over the text box, click once, and then press and release the Alt, Ctrl, or Shift key; you will see a message displayed in the Label control indicating which key you pressed.
Copyright © OnBarcode.com . All rights reserved.