|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (1 bit)
Join Date: Mar 2004
Posts: 1
|
i'm doin a simple program but i'm trying to figure out this message box stuff.....
i have a variable called intSum that is total of all the rolls of the dice (yes, it's the lame dice game). i want to display a message box that says 'you lose' as the title bar and 'your score is ##' for the body of the message box. i can only get it to display only the variable if i only includ ethe variable and nothing else. ... e.g. msgbox (intSum, , "You Lose") i was going to make another form as a message box with the yes, no buttons asking if you wanna play another game, AND showing the score (intSum), but i KNOW there's an easy way to do it with a msgbox. any help??? THANKS!!!!!! Option Explicit Dim intRolls(29) As Integer dim intRollNum As Integer dim intCounter As Integer dim intsum As Integer Private Sub cmdExit_Click() End End Sub Private Sub cmdHelp_Click() frmDiceGame.Hide frmHelp.Show End Sub Private Sub cmdRoll_Click() Dim intDie As Integer, intForCount As Integer Dim intResults As Integer intCounter = intCounter + 1 If intCounter < 29 Then Randomize 'Simulate roll of die intDie = Int((6 * Rnd) + 1) intRollNum = intRollNum + 1 intRolls(intRollNum) = intDie lstRolls.AddItem "Roll #" & intRollNum & _ ": " & intRolls(intRollNum) intsum = intDie + intsum If intsum > 29 Then lstTotal.Clear lstTotal.AddItem intsum intResults = MsgBox _ ("Do you want to play again?", vbYesNo, "You Lose") lstRolls.Clear lstTotal.Clear If intResults = 6 Then 'Start another game intCounter = 0 intsum = 0 intRollNum = 0 Else End End If Else lstTotal.Clear lstTotal.AddItem intsum End If Else MsgBox ("You may not roll again") Exit Sub End If Debug.Print intRolls(intCounter) End Sub Private Sub cmdStop_Click() Dim intResults As Integer If intsum < 26 Then intResults = MsgBox("You can't stop now!", , "Keep Playing") Exit Sub Else intResults = MsgBox(intsum, vbYesNo, "Play again?") If intResults = 6 Then intCounter = 0 intsum = 0 intRollNum = 0 lstTotal.Clear lstRolls.Clear Else End End If End If End Sub |
|
|
|
|
|
#2 |
|
Member (7 bit)
Join Date: Feb 2004
Location: Owings Mills, MD
Posts: 95
|
MsgBox ("Your score is " & intSum, ,"You Lose")
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|