3. Sample Program
8
R4K-80 series -LEt option
3. Sample Program
3-1 VB sample program
Here below is a sample program Visual basic.
Form1
Text1
Label3
Label5
Command1
Command2
Winsock1
Dim strReadBuffer As String
Private Sub Form_Load()
‘Form load
Winsock1.LocalPort = 0
‘Change local port setting to 0
Winsock1.RemoteHost = "192.168.10.1"
‘Remote host is that IP address of power supply is
assigned.
Here, set Default “192.168.10.1”
Winsock1.RemotePort = "10001"
‘Assign remote port number as "10001".
Winsock1.Connect
‘Request for connection
End Sub
Private Sub Command1_Click()
‘When Command1button clicked
Dim wdata As String
On Error GoTo ErrorHandler
Label5.Caption = ""
wdata = Text1.Text & Chr(&HD)
‘Gobble down the word data from Text1.
Winsock1.SendData wdata
‘Send data to remote computer(Power supply)
Label5.Caption = "Write OK!"
Exit Sub
ErrorHandler:
Label5.Caption = "Write NG!"
End Sub