Android Question vb6 code to to B4a Android converter

streetfighter

New Member
vb6 code to android converter
first I tried to search for emulator to make the vb6 .exe file work on android, but I didn't find anyone :(
I read about Converting VB6 to B4A so it can work on Android mobile,
I installed B4A on my computer,
and read this Tutorial
https://www.b4x.com/android/forum/threads/converting-vb6-to-b4a.9347/
but I didn't understand anything
so Please help me converting this code to Android,

B4X:
Private Sub Form_Load()
Dim strName As String
    strName = Winsock1.LocalIP
    txtIP = strName
End Sub

B4X:
Private Sub cmdConnect_Click()
On Error Resume Next
Winsock1.RemoteHost = txtIP.Text
Winsock1.RemotePort = txtPort.Text
Winsock1.Connect
txtLog.ForeColor = &HC000&
txtLog = "Connected"
End Sub

B4X:
Private Sub cmdClose_Click()
Winsock1.Close
txtLog = "Not Connected" & vbCrLf
txtLog.ForeColor = &HFF&
End Sub


B4X:
Private Sub cmdSend_Click()
On Error Resume Next
Winsock1.SendData text1.Text & vbTab & text2.Text
End Sub

B4X:
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
If Winsock1.State <> sckClose Then
Winsock1.Close
txtLog = "Not Connected" & vbCrLf
txtLog.ForeColor = &HFF&
End If
Winsock1.Accept requestID
txtLog = "Connected" & vbCrLf
txtLog.ForeColor = &HC000&
End Sub

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
because on computer will be the Host of the connection from mobile android
this code will be in another project on the computer

B4X:
Private Sub cmdHost_Click()
On Error Resume Next
Winsock1.LocalPort = txtPort.Text
Winsock1.Listen
End Sub

B4X:
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim Data As String, Segments() As String
Winsock1.GetData Data, vbString
Segments = Split(Data, vbTab)
Text1 = Segments(0)
Text2 = Segments(1)
End Sub

B4X:
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
If Winsock1.State <> sckClose Then
Winsock1.Close
txtLog = "Not Connected" & vbCrLf
txtLog.ForeColor = &HFF&
End If
Winsock1.Accept requestID
txtLog = "Connected" & vbCrLf
txtLog.ForeColor = &HC000&
End Sub

B4X:
Private Sub cmdClose_Click()
Winsock1.Close
txtLog = "Not Connected" & vbCrLf
txtLog.ForeColor = &HFF&
End Sub

Thanks :)
 
Top