Private Sub Form_Load() cmdOk.Enabled = False '1锁定确定键 frmSale.Caption = "欢迎进入拍卖界面" frmSale.BackColor = &HC0E0FF lblName.Caption = "悠闲" lblName.AutoSize = True lblName.BackStyle = 0 PicClass.AutoSize = True PicClass = LoadPicture("" & App.Path & "\youxian.gif") lblTi.Caption = "你愿意出多少时间来获得悠闲?" lblTi.AutoSize = True lblTi.BackStyle = 0 txtSale = "" cmdOk.Caption = "确定" cmdOk.BackColor = &HFFC0C0 txtSale.TabIndex = 0 End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) cmdOk.BackColor = &HFFC0C0 End Sub
Private Sub cmdOk_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) cmdOk.BackColor = &HC0FFFF End Sub
Private Sub txtSale_Change() '1锁定确定键,如果文本框发生改变,则激活确定的BUTTON cmdOk.Enabled = True End Sub
Private Sub cmdOk_Click() Dim num As Integer '2申明一个变量用来存放输入的价格 If lblName = "悠闲" Then num = Val(txtSale.Text) If num / 100 <> 0 Then '2判断其是否为100的倍数,否的话提示 If Val(txtSale.Text) > 3000 Then MsgBox "你太大方了吧?多了哦!", , "提示" txtSale = "" txtSale.SetFocus Exit Sub ElseIf Val(txtSale.Text) < 3000 Then MsgBox "你真小气,悠闲是很难得的~", , "提示" txtSale = "" txtSale.SetFocus Exit Sub Else MsgBox "你真有水准,知道合适的安排时间达到悠闲的境界", , "提示" txtSale = "" txtSale.SetFocus lblName = "开心" PicClass = LoadPicture("G:\accp\VB\第三课练习\kaixin.gif") lblTi = "你愿意用多少精力让自己开心起来?" Exit Sub End If Else MsgBox "请输入100的倍数" txtSale = "" txtSale.SetFocus Exit Sub End If ElseIf lblName = "开心" Then 'num = Val(txtSale.Text)'这里的问题,请问如何能让NUM接受第2次赋值并判断? 'If num / 100 <> 0 Then If Val(txtSale.Text) > 50000 Then MsgBox "不是吧,你的精力这么旺盛?", , "提示" txtSale = "" txtSale.SetFocus Exit Sub ElseIf Val(txtSale.Text) < 50000 Then MsgBox "开心没有那么简单就可以得到的咯", , "提示" txtSale = "" txtSale.SetFocus Exit Sub Else MsgBox "这都让你说中,真乃神人也!", , "提示" Unload Me frmBingo.Show End If ' Else ' MsgBox "请输入100的倍数" ' txtSale = "" ' txtSale.SetFocus ' Exit Sub ' End If End If End Sub
[此贴子已经被作者于2005-5-11 8:51:57编辑过]