Teach Yourself Visual Studio® .NET 2003 in 21 Days [Electronic resources]

Jason Beres

نسخه متنی -صفحه : 270/ 53
نمايش فراداده

Q&A

Q1:

I want to be able to use control arrays to handle multiple events. Where did that functionality go?

A1:

Control arrays do not exist in Visual Basic .NET. Each control you add has its own event that you can write code for. You can, however, handle multiple events with a single method. You did this earlier with the genericClick event in the forms exercises. You can also use the Handles keyword to indicate what events a method should consume, as the following code demonstrates:

Private Sub Button5_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button5.Click, Button3.Click, Button4.Click, Button2.Click
End Sub
Q2:

Can I use ActiveX controls from Visual Basic 6 in my .NET Windows Forms applications?

A2:

Yes, you can. Although the interop between COM and .NET has some overhead, the functionality is built in. To add an ActiveX control to the Toolbox, you can right-click on the Toolbox and select Customize. From this dialog, you can select the ActiveX controls to add to your application. Most third-party vendors have .NET certified controls. For some of the more popular controls, visit http://www.infragistics.com and http://www.componentone.com.

Q3:

Windows Forms are awesome. Where can I get more details? The QuickStart tutorials only take me so far.

A3:

Microsoft has a Web site specifically for Windows Forms. Check out http://www.windowsforms.net to get tons of great information about developing forms applications.