Convert vb6 program to B4J

Beja

Expert
Licensed User
Longtime User
Hi All
Need to convert the following small vb project to B4J..
reward $50
(In VB6 this code is working fine)

VB6 Code:
B4X:
Private Sub btnExit_Click()
 End
 End Sub
 
 Private Sub btnRead_Click()
 'Read messages from modem
 MSComm1.Output = "AT+CMGR=1" & vbCrLf
 End Sub
 
 Private Sub btnSend_Click()
 'send comand to (phone number) as string through the modem
 aa = "AT+CMGF=1" & Chr$(13)
 bb = "AT+CMGS=" & Chr$(34) & "+1999999999" & Chr$(34) & Chr$(13)
 cc = "Where" & Chr$(26)
 dd = aa & bb & cc
 MSComm1.Output = dd
 End Sub
 
 Private Sub btnDelete_Click()
 'Delete all messages and clear modem messages buffer
 MSComm1.Output = "AT+CMGD=1,4" & vbCrLf
 End Sub
 
 Private Sub Form_Load()
 Form1.Caption = "Hot Dog Cart"
 With MSComm1
 .CommPort = 6
 .Handshaking = 2 - comRTS
 .RThreshold = 1
 .RTSEnable = True
 .Settings = "9600,n,8,1"
 .SThreshold = 1
 .PortOpen = True
 ' Leave all other settings as default values.
 End With
 Text1.Text = ""
 End Sub

  Private Sub Form_Unload(Cancel As Integer)
 MSComm1.PortOpen = False
 End Sub

  Private Sub MSComm1_OnComm()
 For i = 1 To 2000: Next
 'MsgBox "something"
 Dim InBuff As String '
 
 Select Case MSComm1.CommEvent
 
 Case comEvReceive ' Received RThreshold # of chars.
 'Timer1.Enabled = True
 For x = 1 To 1000: Next
 InBuff = MSComm1.Input
 
 Call HandleInput(InBuff)
 End Select
 End Sub

  Sub HandleInput(InBuff As String)
 For x = 1 To 1000: Next
 Dim mm As String
 Text1.SelStart = Len(Text1.Text)
 Text1.SelText = InBuff
 End Sub
 
Last edited:
Top