Home > Software engineering >  The left function can be used, right function cannot be used
The left function can be used, right function cannot be used

Time:09-27

VB to fore and aft according to string two characters to determine if data for I want, today suddenly tight can't use the
I use two text boxes, display the first and last one character at a time, the results of the first out, last extracted out
Program the following

Private Sub Winsockserver_DataArrival (ByVal bytesTotal As Long)
'to receive data functionDim TMPSTR As String
Winsockserver. GetData TMPSTR
Text3. Text=Left (TMPSTR, 1)
Text2. Text=Right (TMPSTR, 1)
Textget. Text=TMPSTR
If Left (TMPSTR, 1)="@" And Right (TMPSTR, 1)="#" Then
Text1. Text=Mid (TMPSTR, 2, 5)

End the If
End Sub

CodePudding user response:

Can normally use, server, set up by using the wincock through GPRS module to VB program, the right function is not working

CodePudding user response:

Look the debug right (TMPSTR, 1), then the len (right (TMPSTR, 1) to see if greater than 0

If it is

You defined TMPSTR length is longer than what you actually get the length of the data, and could you take to just one space...

CodePudding user response:

 Debug. Print Len (TMPSTR), "|" & amp; Tempstr & amp; "|" "

Check the received data, there are other content at the end of may,

CodePudding user response:

Try to use:
VBA. Right

CodePudding user response:

The
reference 3 floor Tiger_Zhao response:
 Debug. Print Len (TMPSTR), "|" & amp; Tempstr & amp; "|" "

Check the received data, there are other content at the end of may,

Agree, the received data is likely to contain other data.




CodePudding user response:

Thank you for your answer, thank you
  • Related