teeling
asked on
wsTCP.SendData does not send Chr(13) as Carriage Return
Sending Chr(13) is supposed to be equivalent to pressing 'Enter' on the keyboard. However, the program thinks that I am trying to send the string "Chr(13)". How can I go about this problem? Thanks.
Private Sub cmdLogin_Click()
If Run.Value Then
progctrfinal = TextBox1.Value
For progctr = 1 To progctrfinal Step 1
Call optionStatus(progctr)
Next progctr
End If
End Sub
Function CommandCode(PC As Long)
Dim command As String
Dim argPassedIn As String
Debug.Print progctr
command = Worksheets("GUI").Cells(PC + 1, 2).Value
argPassedIn = Worksheets("GUI").Cells(PC + 1, 3).Value
Debug.Print command & " " & (argPassedIn)
If command = "MySend" Then Call MySend(argPassedIn)
End Function
Function MySend(ByVal data As String)
DoEvents
wsTCP.SendData data
End Function
Private Sub optionStatus(ByVal progctr As Long)
Select Case progctr
Case 1
Login
Call WaitCurs(20, 51)
If Not CurPos Then Exit Sub
Case 2
Call CommandCode(progctr)
Case 3
CommandCode progctr
'
Case 4
CommandCode progctr
Case 5
Debug.Print "Case 5"
CommandCode progctr
Case Else
Debug.Print "No match"
'Code for any nonmatch
End Select
End Sub
main-menu.JPG
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I found out what's the problem. I have sent an extra sets of "". Thanks for the help :)
ASKER
Prompt reply.
ASKER
Another related question, what if I'm trying to send the key F1, which is a combination of several characters, i.e. Chr(27) & "O" & "P"?
ASKER
If I were to do this manually, pressing enter sends me straight to another menu.
Thanks.
Selection-0.JPG