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 Sub
ElseIf 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 If
End Sub
uj5u.com熱心網友回復:
哪一句錯了?Label2(Index),這里的index是從0開始的,一直到Label2.count-1
uj5u.com熱心網友回復:
ftSend(MyID) 兩個變數都看不到定義、賦值。出錯了要除錯啊,看代碼是找不出錯誤的。
uj5u.com熱心網友回復:
在VB6 IDE中運行,出錯時在彈出的對話框上點除錯,游標會自動定位到出錯的源代碼行并進入立即模式,此時在立即視窗中使用?變數名
可以查看各變數的值。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/93860.html
標籤:VB基礎類
上一篇:如何區分出多把USB掃描槍資訊
下一篇:VB把X軸的時間改間隔長一點
