引用:
作者: mini
也可改成
A例)
語法:
If Form1.Text1 = sPW And Form1.Text2 = sID Then
Label1.Caption = "連線成功"
Else
Label1.Caption = "連線失敗(帳號或密碼有誤)"
End If
B例)
不過照理說
語法:
If Form1.Text1 <> sPW Or Form1.Text2 <> sID Then
Label1.Caption = "連線失敗(帳號或密碼有誤)"
Else
Label1.Caption = "連線成功"
End If
B例 與上面 A例 是同樣的邏輯答案
|
這是Form2的程式碼
PHP 語法:
Private Sub Command1_Click()
Unload Form2
With Form1
.Text4.Enabled = True
.Command1.Enabled = True
.Text4.SetFocus
.Text4.SelStart = 0
.Text4.SelLength = Len(.Text1.Text)
End With
End Sub
Private Sub Form_Load()
Label1.Caption = "連線中"
Timer1.Enabled = True
Timer1.Interval = 500
Command1.Visible = False
End Sub
Private Sub Timer1_Timer()
Static i As Integer
If i > 5 Then
Timer1.Enabled = False
If Form1.Text4 = sPW And Form1.Text5 = sID Then
Label1.Caption = "連線失敗(帳號或密碼有誤)"
Else
Label1.Caption = "連線成功"
Form1.Frame1.Enabled = True
Form1.Frame2.Enabled = True
Form1.Check1.Enabled = True
Form1.Check2.Enabled = True
Form1.Check3.Enabled = True
Form1.Check4.Enabled = True
Form1.Check5.Enabled = True
Form1.Check6.Enabled = True
Form1.Check7.Enabled = True
Form1.Check8.Enabled = True
Form1.Check9.Enabled = True
Form1.Check10.Enabled = True
Form1.Check11.Enabled = True
Form1.Text1.Enabled = True
Form1.Text2.Enabled = True
Form1.Command1.Enabled = True
Form1.Command2.Enabled = True
Form2.Command1.Visible = True
End If
i = 0
Exit Sub
End If
i = i + 1
If i = 1 Or i = 4 Then
Label1.Caption = "連線中。"
Else
Label1.Caption = Label1.Caption & "。"
End If
End Sub
以下是Form1的程式碼
PHP 語法:
Private Sub Command3_Click()
Text4.Enabled = False
Command3.Enabled = False
Form2.Show
Form2.Move Form1.Left, Form1.Top - Form2.Height
End Sub
Private Sub Form_Activate()
sPW = "kenc77996"
sID = "ken33664"
End Sub
以上程式碼是以text4 和text5 下去編寫
發現 text4 和text5 隨便打 都會顯示連線成功...幫檢查一下卸卸...