Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Tutorial - Error Message?

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-18-2007, 04:14 PM
Junior Member
 
Join Date: Sep 2007
Location: Silicone Valley
Posts: 26
Question Tutorial - Error Message?

As Erel suggested, I'm posting the code I typed in for the new tutorial as I get an error message regarding:

Quote:
Missing Keyword: End Sub
Occurred on line: 33
End If

This refers to this section of code near the end:
Code:
Else
             AppClose
      
End If
End If
Maybe I just need to get new eyeglasses, but I don't see what's wrong?

Thanks,

Mark


Code:

Sub Globals
    
'Declare the global variables here.
    Dim Number

End Sub

Sub App_Start
    Form1.Show
    Number = 
Rnd(1,100)'Randomly chooses a number
End Sub


Sub btnGuess1_Click
    
If Not (IsNumber(txtNumber1.Text))Then 'User didn't enter valid number
    'Same as If Not (IsNumber(txtNumber1.Text)= False Then
    
        
Msgbox ("Please enter a valid number")
    
Return 
End If

If txtNumber1.Text > number Then 'Check the user guess
    Msgbox ("My number is smaller")
    
Else If txtNumber1.Text < number Then 
    
Msgbox ("My number is larger")
    
Else 'The user has found the right number
    Msgbox ("Congrats, you've found the right number!"crlf & "Do you want to play a new game?""", cMsgbox YesNo) = cYes Then
    number = 
Rnd (1,100)
    
Else
        AppClose
    
End If
End If

txtNumber1.focus 
'Returns focus to textbox & selects text
txtNumber1.SelectionStart = 0
txtNumber1.SelectionLength = StrLength (txtNumber1.Text)
End Sub
__________________
Silicone Valley Digerati/Code Noob
HTC Advantage X7501/WM6
Kohjinsha SH6/Vista HP (For Sale, PM me...)
MacBook C2D
Reply With Quote
  #2 (permalink)  
Old 09-18-2007, 04:43 PM
Knows the basics
 
Join Date: May 2007
Location: Czech Republic
Posts: 72
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Hi,
there is missing command "IF" in line :
IF Msgbox ("Congrats, you've found the right ...
So you have more End IF then IF commands and it takes an Error message.
I recomend you to give IF ELSE and END IF commands on the same TAB position (as you can see in Erel's example), so your code will be more synoptical.
Petr
Reply With Quote
  #3 (permalink)  
Old 09-18-2007, 04:49 PM
willisgt's Avatar
Senior Member
 
Join Date: Aug 2007
Location: Nacogdoches, Texas USA
Posts: 162
Default Code Fix

Archimark -

Change the line

Quote:
Msgbox ("Congrats, you've found the right number!"...
to

Quote:
If Msgbox ("Congrats, you've found the right number!"...
That'll get it.

Gary
Reply With Quote
  #4 (permalink)  
Old 09-18-2007, 05:13 PM
Junior Member
 
Join Date: Sep 2007
Location: Silicone Valley
Posts: 26
Question

THANKS for your help, petrbury & willisgt. Really appreciate it!!!

The good news is that the error message went away!!

The bad news is that now when I run the app and I enter the right number I get the following error message:

Code:
An error occurred on sub btnguess_click.

line number: 
28

If Msgbox ("Congrats, you've found the right number!" & crlf & "Do you want to play a new game?"" ", cMsgbox YesNo) = cYes Then

Error Description:

Variable: cmsgbox was 
not assigned any value.

Continue?
Then it gives you a 'Yes' or 'No' button to choose from....

__________________
Silicone Valley Digerati/Code Noob
HTC Advantage X7501/WM6
Kohjinsha SH6/Vista HP (For Sale, PM me...)
MacBook C2D
Reply With Quote
  #5 (permalink)  
Old 09-18-2007, 05:57 PM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 1,057
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Hi ArchiMark,

there must be no space between "cMsgbox" and "YesNo" since only "cMsgboxYesNo" is a vaild basic4ppc messagebox constant.
So change
Code:
If Msgbox ("Congrats, you've found the right number!" & crlf & "Do you want to play a new game?"" ", cMsgbox YesNo) = cYes Then
to
Code:
If Msgbox ("Congrats, you've found the right number!" & crlf & "Do you want to play a new game?"" ", cMsgboxYesNo) = cYes Then
and the tutorial should work as expected...

specci48
Reply With Quote
  #6 (permalink)  
Old 09-18-2007, 06:25 PM
Junior Member
 
Join Date: Sep 2007
Location: Silicone Valley
Posts: 26
Thumbs up

Quote:
Originally Posted by specci48 View Post
Hi ArchiMark,

there must be no space between "cMsgbox" and "YesNo" since only "cMsgboxYesNo" is a vaild basic4ppc messagebox constant.
So change
Code:
If Msgbox ("Congrats, you've found the right number!" & crlf & "Do you want to play a new game?"" ", cMsgbox YesNo) = cYes Then
to
Code:
If Msgbox ("Congrats, you've found the right number!" & crlf & "Do you want to play a new game?"" ", cMsgboxYesNo) = cYes Then
and the tutorial should work as expected...

specci48

That did it, specci48. THANKS for your help!
__________________
Silicone Valley Digerati/Code Noob
HTC Advantage X7501/WM6
Kohjinsha SH6/Vista HP (For Sale, PM me...)
MacBook C2D
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with error message skmobile Questions (Windows Mobile) 2 09-07-2008 07:07 PM
ERROR:Message cdeane Questions (Windows Mobile) 10 07-21-2008 06:59 PM
Key in dictionary error message rossj Questions (Windows Mobile) 2 03-07-2008 11:22 AM
Error When Loading Tutorial corwinckler Questions (Windows Mobile) 2 12-12-2007 01:24 PM
Error Message PepSoft Questions (Windows Mobile) 2 11-19-2007 01:59 PM


All times are GMT. The time now is 11:12 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0