|
-
May 29th, 2000, 01:24 PM
#1
Thread Starter
Addicted Member
I trying to do this...
Make a program that once the user presses the command button a text message appears..and then if he presses he/she command button again, a different message appears.
I have the user interface finished,also i have the code done for the first message that appears,but what code/else do i do??
I appreciate any help.
-
May 29th, 2000, 03:35 PM
#2
Private Sub Command1_Click
Static blnState As Boolean
If not blnState Then
MsgBox "Message 1"
else
MsgBox "Message 2"
End If
blnState = blnState + 1
End Sub
-
May 29th, 2000, 04:46 PM
#3
Thread Starter
Addicted Member
-
May 29th, 2000, 05:13 PM
#4
Frenzied Member
Sascha's code switches btween message 1 and message 2 each time the command button is pressed
if you want message 2 to be displayed for all presses >1 then set blnState to true after the first press
I expect you worked this out for yourself anyway 
Code:
Private Sub Command1_Click()
Static blnState As Boolean
If Not blnState Then
MsgBox "Message 1"
blnState = True
Else
MsgBox "Message 2"
End If
End Sub
-
May 29th, 2000, 05:45 PM
#5
transcendental analytic
Ok this is probably needless, but try it out 
Code:
Private Sub Command1_Click()
Static blnState%
select case blnState
case blnstate 1
Msgbox "Message 1"
case blnstate 2
Msgbox "Message 1"
case blnstate 3 to 5
Msgbox "Messages for 3 to 5"
case blnstate else
Msgbox "Messages after that"
end select
blnState=blnState+1
End Sub
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 30th, 2000, 12:31 AM
#6
Hyperactive Member
Dim Check as Boolean
Private Sub Command1_Click()
If Check = False Then
Msgbox "Message 1"
Check = True
Else
Msgbox "Message 2"
Check = False
End if
End Sub
When you click the first time, Message 1 will be shown. The second time you click Message 2 will be shown. The third time you click Message 1 will be shown, and so on....
/Smirre
-
May 30th, 2000, 05:13 AM
#7
If you want to use the code in multiple CommandButtons, you can Declare it as Public or Global, in a module then use Kedaman's Code. (without the Static variable)
-
May 30th, 2000, 03:33 PM
#8
transcendental analytic
If you don't want any more answer lock this thread
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|