Private Sub Label2_Click(Index As Integer)
If Index = 1 Then
If Label2(Index).Caption = "传送文件" Then
If List1.ListIndex = 0 Then
MsgBox "不能给所有人发送文件!", , "文件发送提示(聊天室)"
Else
NVAL = MsgBox("要给 " & List1.Text & " 发送文件吗?", vbYesNo + vbQuestion, "发送文件提示(聊天室)")
If NVAL = vbYes Then
jsname = List1.Text
ipks = InStr(List1.Text, "(") + 1 '判断在线名单中ip地址的开始
IPlen = Len(List1.Text) - ipks '判断在线名单中ip地址的长度
aa3 = Mid(List1.Text, ipks, IPlen)
fileip = myip & aa3
SendFile fileip 'change destination
On Error GoTo Err_DetermineErr
With CommonDialog1
.CancelError = True
.DialogTitle = "打开文件"
.Filter = "所有文件 (*.*)|*.*"
.ShowOpen
End With
txtFile = CommonDialog1.FileName
With ftSend(MyID)
.Comment = txtComments
.FileSize = CDbl(FileLen(txtFile))
.FileToSend = txtFile
.frmSend.InitTransfer MyID
End With
SendClicked = True
Label2(Index).Caption = "取消传送"
End If
End If
Else
Label2(Index).Caption = "传送文件"
ftSend(MyID).frmSend.fileCancel '取消文件传送
Winsock1.RemoteHost = fileip
Winsock1.SendData Na1 & " the find over."
End If
Err_DetermineErr:
Exit SubElseIf Index = 3 Then
'将 Cancel 设置成 True
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
'设置 Flags 属性。
CommonDialog1.Flags = cdlCFBoth Or cdlCFEffects
'显示“字体”对话框。
CommonDialog1.ShowFont
'根据用户的选择来设置文本属性。
Text2.Font.name = CommonDialog1.FontName
Text2.Font.Size = CommonDialog1.FontSize
Text2.Font.Bold = CommonDialog1.FontBold
Text2.Font.Italic = CommonDialog1.FontItalic
Text2.Font.Underline = CommonDialog1.FontUnderline
Text2.SelColor = CommonDialog1.Color
Exit Sub
ErrHandler:
'用户按了“取消”按钮。
Exit Sub
ElseIf Index = 2 Then
Picture1.Visible = True
Picture1.SetFocus
End IfEnd Sub
If Index = 1 Then
If Label2(Index).Caption = "传送文件" Then
If List1.ListIndex = 0 Then
MsgBox "不能给所有人发送文件!", , "文件发送提示(聊天室)"
Else
NVAL = MsgBox("要给 " & List1.Text & " 发送文件吗?", vbYesNo + vbQuestion, "发送文件提示(聊天室)")
If NVAL = vbYes Then
jsname = List1.Text
ipks = InStr(List1.Text, "(") + 1 '判断在线名单中ip地址的开始
IPlen = Len(List1.Text) - ipks '判断在线名单中ip地址的长度
aa3 = Mid(List1.Text, ipks, IPlen)
fileip = myip & aa3
SendFile fileip 'change destination
On Error GoTo Err_DetermineErr
With CommonDialog1
.CancelError = True
.DialogTitle = "打开文件"
.Filter = "所有文件 (*.*)|*.*"
.ShowOpen
End With
txtFile = CommonDialog1.FileName
With ftSend(MyID)
.Comment = txtComments
.FileSize = CDbl(FileLen(txtFile))
.FileToSend = txtFile
.frmSend.InitTransfer MyID
End With
SendClicked = True
Label2(Index).Caption = "取消传送"
End If
End If
Else
Label2(Index).Caption = "传送文件"
ftSend(MyID).frmSend.fileCancel '取消文件传送
Winsock1.RemoteHost = fileip
Winsock1.SendData Na1 & " the find over."
End If
Err_DetermineErr:
Exit SubElseIf Index = 3 Then
'将 Cancel 设置成 True
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
'设置 Flags 属性。
CommonDialog1.Flags = cdlCFBoth Or cdlCFEffects
'显示“字体”对话框。
CommonDialog1.ShowFont
'根据用户的选择来设置文本属性。
Text2.Font.name = CommonDialog1.FontName
Text2.Font.Size = CommonDialog1.FontSize
Text2.Font.Bold = CommonDialog1.FontBold
Text2.Font.Italic = CommonDialog1.FontItalic
Text2.Font.Underline = CommonDialog1.FontUnderline
Text2.SelColor = CommonDialog1.Color
Exit Sub
ErrHandler:
'用户按了“取消”按钮。
Exit Sub
ElseIf Index = 2 Then
Picture1.Visible = True
Picture1.SetFocus
End IfEnd Sub
Label2(Index),这里的index是从0开始的,一直到Label2.count-1
?变量名
可以查看各变量的值。