Using Events Within The Visual Studio .NET Environment
The Visual Studio .NET environment has built-in support for "wiring-up" and using component events, making their use simple.
To "wire-up" an event using the Visual Studio environment using VB.NET, use the following steps. (Steps for C# follow).
- Start a new VB.NET project and add a component to the form (see Placing Components on a Form for information on how to do this). For this example, the Tcp component is used.
- Navigate to View, and then select Code to switch to code view.
- From the "drop-down" boxes at the top of the Code Window, select the instance of the Tcp component from the box on the left, and then the name of the event you would like to "wire-up" from the box on the right (see screenshot below).
- After doing this, the Visual Studio .NET environment will transparently create the necessary code to "wire-up" the event. The code should look similar to the following (using the Tcp.EndSend event as an example).
Private Sub Tcp1_EndSend(ByVal sender As Object, ByVal e As Dart.PowerTCP.SslSockets.SegmentEventArgs) Handles Tcp1.EndSend
' Write event handling code here.
End Sub
- Now you can use the EndSend method and handle the completion of the method in the EndSend event.
To "wire-up" an event using the Visual Studio environment using C#, use the following steps.
- Start a new C# project and add the Tcp component to the form (see Using A Component Within Visual Studio .NET for information on how to do this).
- Click the component icon, created on the panel underneath the form.
- On the Properties Window click the "lightning bolt" icon to display all events for the Tcp component.
- Double-click the event you wish to "wire-up" (see screenshot below).
- After doing this, the Visual Studio .NET environment will automatically create the necessary code to "wire-up" the event. The code should look similar to the following (using the EndSend event as an example).
private void tcp1_EndSend(object sender, Dart.PowerTCP.SslSockets.SegmentEventArgs e)
{
// Write event handling code here.
}
- Now you can use the EndSend method and handle the completion of the method in the EndSend event.
In This Section
- Creating a Project
- This topic demonstrates how to create a new Windows project in Visual Studio .NET.
- Placing Components on a Form
- This topic demonstrates how to create and use a control using Visual Studio .NET.
- Creating Components Dynamically
- This topic demonstrates how to add a component as a reference using Visual Studio .NET.
- Creating Custom Dlls
- Discusses the steps required when creating a dll that uses a PowerTCP control.
- Using Components Outside of Visual Studio
- This topic discusses the use of the components without Visual Studio.
- Using Events within the Visual Studio .NET Environment
- Describes how to use PowerTCP events within the Visual Studio .NET environment.
- Using Events when a Component is Created Dynamically
- Describes the extra steps required to use events when using a PowerTCP component as a reference.
Sockets Using Menublock
Send comments on this topic.
Documentation version 1.1.2.0.
© 2008 Dart Communications. All rights reserved.