Page 1 of 1
Posted: Tue Jan 08, 2002 3:07 pm
by Shak
how would I do this in VB/
I am really stuck on it
Shak
Posted: Tue Jan 08, 2002 4:49 pm
by Ghoast
MsComm1.OutPut=label2.Caption works fine for that. put a MsComm control in a form and open the port, send the data and you're done. To send a command send MsComm1.OutPut=Chr(254) <command> where Chr(254) is the command prexif followed by a command. For example, to turn backlight on indefinetly send Chr(254) & Chr(66) & Chr(0)
or to place the cursor at column 1, row 1 send Chr(254) & Chr(71) & Chr(1) & Chr(1)
the command set is in the manual. remember to send decimals if you use Chr command.
Posted: Tue Jan 08, 2002 4:56 pm
by Ghoast
Use this source code in a form containing a Ms comm control, a command button named Command1 and a label named Label1:
Private Sub Form_Load()
'Open comm port.
MSComm1.PortOpen = True
'Turn on backlight indefinetly
MSComm1.Output = Chr(254) & Chr(66) & Chr(0)
End Sub
Private Sub Command1_Click()
'Set cursor at column 1, row 1.
MSComm1.Output = Chr(254) & Chr(71) & Chr(1) & Chr(1)
'Send caption of Label1 to the comm port.
MSComm1.Output = Label1.Caption
End Sub
Private Sub Form_Unload(Cancel As Integer)
'Close comm port.
MSComm1.PortOpen = False
End Sub
Posted: Thu Jan 10, 2002 10:21 am
by Shak
nice one ghoast
Shak