Newsgroup: it.comp.lang.visual-basic
Titolo: i got a question

I have a simple task i have to build for my intro to VB class. here is
the situation: Create a form with a label and two command buttons
captioned Bogart and Raines.  When Bogart is first pressed, the sentence
"I came to Casablanca for the waters" is displayed in the label.  The
next time Bogart is pushed it should say, "I was misinformed".	When
raines is pushed, it should say "But we're in the middle of the desert." 
Run the program and then press Bogart , Raines, Bogart to obtain a
dialogue.
Here is my code:
cmdBogart_click()
If cmdRaines.Enabled=True Then
lbltalk.caption="I was misinformed"
Else
lbltalk.caption="I came to casablance for the waters"
cmdRaines_click()
lbltalk.caption="But we're in the middle of the desert."
The way it is right now it only displays the "I was misinformed" Bogart
remark.  This is due on thursday for part of a homework assignment.
Please email me directly a correction to this solution. I would
appreciate it greatly. Thanks Steve S. 
Socce...@prodigy.net
-------------------==== Posted via Deja News ====-----------------------
 
http://www.dejanews.com/
     Search, Read, Post to Usenet

...

This works:
=============================CODE====================================
Option Explicit
Private Sub cmdBogart_Click()
    Static bWhichSentence As Boolean
 
    If bWhichSentence = False Then
        lblTalk.Caption = "I came to Casablanca for the waters"
    Else
        lblTalk.Caption = "I was misinformed"
    End If
 
    bWhichSentence = Not bWhichSentence
End Sub
Private Sub cmdRaines_Click()
    lblTalk.Caption = "But we're in the middle of the desert."
End Sub
==================================================================
Domenico Statuto

appreciate it greatly. Thanks Steve S. 
Socce...@prodigy.net
You need to set the Raines.Enabled property to false when the app
loads.  Since you're asking for help on a school project, I'll let you
figure out the rest...  :)
---------------------
John Tabor
jta...@idsonline.com
http://www.kinetic-media.com/users/jtabor

captioned Bogart and Raines.  When Bogart is first pressed, the sentence
I like the problem so I tryed it. It's just friday overhere so not
much to do.... 
Just make use of a variable and it will work fine..
make a new project, a new form; put a label on it and an indexed
commandbutton (index 0 & 1).
Put the next code in place; then press f5.
'general declarations
Dim vRaines%
Private Sub Form_Load()
    vRaines = False
 
End Sub
Private Sub Command1_Click(Index As Integer)
    Select Case Index
    Case 0  'bogart
        If vRaines Then
            Label1.Caption = "I was misinformed."
            vRaines = False
        Else
            Label1.Caption = "I came to Casablanca for the waters."
        End If
    Case 1  'raines
        Label1.Caption = "But we are in the middle of the desert!"
        vRaines = True
    End Select
End Sub
good luck
gr. walther
----- never stop here -----
Walther Musch;
http://pi1438.kub.nl:2080/VisualBasicSource/
   Get PR-Tracker -- tracks problem reports, defects, bugs
   INFORMATION:  
http://www.halcyon.com/softwise/prtracker.html
   DOWNLOAD:     
http://www.halcyon.com/softwise/download.html