引用:
作者: 劍痞憶秋年
MSGBOX 可能無法達到你要的,因為要按一下才會再換下一個新的訊息(無法直接 控制/改變 訊息內容)
所以咧,我就用表單 + TIMER 來試做你要的,不過看不到最後的 連線成功
試看看如何
PHP 語法:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
LockControls = -1 'True
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '系統預設值
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 495
Left = 1440
TabIndex = 0
Top = 1200
Width = 1215
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
With Form2
'清空計數器
.Times = 0
.Show
End With
End Sub
PHP 語法:
VERSION 5.00
Begin VB.Form Form2
Caption = "Form2"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form2"
LockControls = -1 'True
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '系統預設值
Begin VB.Timer Timer1
Interval = 500
Left = 3360
Top = 2160
End
Begin VB.Label Label1
Caption = "Label1"
Height = 495
Left = 600
TabIndex = 0
Tag = "連線中。"
Top = 960
Width = 1215
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private intTimes As Integer
Private Sub Form_Initialize()
intTimes = 0
Label1.Caption = Label1.Tag
End Sub
Public Property Get Times() As Integer
Times = intTimes
End Property
Public Property Let Times(ByVal vNewValue As Integer)
intTimes = vNewValue
End Property
Private Sub Form_Load()
Label1.Caption = Label1.Tag
End Sub
Private Sub Timer1_Timer()
'
If intTimes = 2 Then
Label1.Caption = "連線成功"
Unload Me
End If
Label1.Caption = Label1.Caption & "。"
intTimes = intTimes + 1
End Sub
|
感覺上...很複雜耶....不然大大你看一下我用的不知道要如何改...
Private Sub Command3_Click()
Dim pw As String
pw = "kenc77996"
If Text4.Text <> pw Then
Label15.Caption = "帳號或密碼錯誤!"
Else
pw = "ken33664"
If Text5.Text <> pw Then
Label15.Caption = "帳號或密碼錯誤!"
Else
Label15.Caption = "登入成功!感謝您使用本程式"
Frame1.Enabled = True
Frame2.Enabled = True
Check1.Enabled = True
Check2.Enabled = True
Check3.Enabled = True
Check4.Enabled = True
Check5.Enabled = True
Check6.Enabled = True
Check7.Enabled = True
Check8.Enabled = True
Check9.Enabled = True
Check10.Enabled = True
Check11.Enabled = True
Text1.Enabled = True
Text2.Enabled = True
Command1.Enabled = True
Command2.Enabled = True
End If
End If
End Sub
以上片段...按下Command出現連線中...一樣跑出句號...然後再檢測PW 如果正確 則顯示登入成功 如果錯誤 則顯示帳號或密碼錯誤 請問如果這樣要如何改...