请帮我看一下我的VB程序错在哪里?

来源:百度知道 编辑:UC知道 时间:2024/05/04 19:34:22
我全编译运行时他提示:
编译错误:case 没有select case
但是我的程序里面明明有写select case
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim a As String
Dim sname As String
Dim sno As String
Dim ssex As String
Dim sage As String
Dim str1 As String '接收到数据立即进行处理,首先要判断的是客户端发送的是什么请求
Dim sta As String
Winsock1.GetData str1, vbString
Text1.Text = str1
sta = Mid(str1, 1, 1) '截取传过来的消息,第一位为状态标志,1:添加,2:确定 3:删除,4:下一条,5:上一条,6:首记录,7:刷新,8:尾记录

Select Case sta

Case 1:
Adodc1.Recordset.AddNew

Case 2:
sname = RTrim(Mid(str1, 2, 6)) '截取消息中的姓名
sno = RTrim(Mid(str1, 8, 9)) '截取消息中的学号
ssex = RTrim(Mid(str1, 17, 1)) '截取消息中的性别
sage = RTrim(Mid(str1, 18, 2)) '截取消息中的年龄
Text2.Text = "姓名" & sname & "学号" & sno & "性别" & ssex & "年龄" & sage

看到了两个End Select ,建议去掉一个

End Select '********************
sname = Text1.Text
sno = Text2.Text
ssex = Text3.Text
sage = Text4.Text
Winsock1.SendData "sndt" & sname & Space(6 - Len(sname)) & sno & Space(9 - Len(sno)) & ssex & sage & Space(2 - Len(sage))
'发送查询到的数据信息给客户端
End Select '********************

倒数第2行,多了一个End Select,去掉就好了

多了一个End Select