我在一个表单中有两个文本控件
txtBB,txtPsd 一个用来输入BB号码,一个用来输入密码
'定义一个全局函数用来给字符串填充空格,补足位数
Public Function fillstr(str As String, num As Integer) As String
Do While Len(str) < num
str = str + " "
Loop
fillstr = str
End Function
Private Sub cmdGo_Click()
Dim strPsd, strIp As String
strBB = txtBB.Text
strPsd = txtPsd.Text
strIp = winsck.LocalIP
If txtBB = "" Or txtPsd = "" Then
MsgBox "BB号码或密码不能为空!!!", vbOKOnly, "BB信使"
If txtUser = "" Then
txtUser.SetFocus
Else
txtPsd.SetFocus
End If
Else
strBB = fillstr(strBB, 9) '这个执行都没问题
strPsd = fillstr(strPsd, 12) '每次执行到这都说strPsd类型不匹配,但它明明是STRING型呀!!!!
MsgBox strPsd + ":"
'用fillstr函数把位数填满
winsck.SendData "0" + strBB + strPsd + strIp
End If
End Sub
[求助]我郁闷惨了,查了半天的错