|
The following is a step-by-step lesson on how to use ActiveX
in VB under Visual Studio
For other VB varieties, including Visual Basic 2008 Express Edition, please visit our classroom
.
In this lesson, we will use Ultimaserial ActiveX to develop a
data acquisition application with DATAQ's Starter kit.
1)
Create a VB project with a simple form
2) Add two buttons
3) Follow Tools->Choose Toolbox Items..., under
COM component tab, select Ultimaserial and XChart
from Ultimaserial
4) You should see the two items added to the toolbox
5) Add these two to the form
6) Double click on the buttons and Ultimaserial icons to so that you can add
codes to it
Here are the codes:
Public Class
Form1
Private
Sub
AxUltimaSerial1_NewData(ByVal
sender As
Object,
ByVal
e As
AxULTIMASERIALLib._DUltimaSerialEvents_NewDataEvent) Handles
AxUltimaSerial1.NewData
AxXChart1.Chart(AxUltimaSerial1.GetData)
End
Sub
Private
Sub
Button1_Click(ByVal
sender As
System.Object, ByVal
e As
System.EventArgs) Handles
Button1.Click
AxUltimaSerial1.ChannelCount = 1
AxUltimaSerial1.Device =
ULTIMASERIALLib.enumDeviceType.DI710
AxUltimaSerial1.CommPort =
ULTIMASERIALLib.enumComPort.USB
AxUltimaSerial1.SampleRate = 100
AxUltimaSerial1.EventLevel = 1
AxUltimaSerial1.Start()
End
Sub
Private
Sub
Button2_Click(ByVal
sender As
System.Object, ByVal
e As
System.EventArgs) Handles
Button2.Click
AxUltimaSerial1.Stop()
End
Sub
End Class
Last update: 04/08/10
Copyright: 2000-2005 www.UltimaSerial.com
|