|
-
Aug 18th, 2005, 09:34 AM
#1
Thread Starter
Junior Member
Boolean help [Resolved]
I'm trying to make a boolean for playerX...looks like this, it's tic tac toe by the way...
VB Code:
dim playerX as boolean
dim Playerturn as boolean
...
...
...
if(playerX = true) & (playerturn = true) then
button1.text = "X"
elseif (PlayerX = false) & (Playerturn = true) then
button1.text = "O"
Else
button1.text = "err"
i get an error once i click on the button...i'll show the exact error message below... :
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.InvalidCastException: Cast from string "FalseFalse" to type 'Boolean' is not valid. ---> System.FormatException: Input string was not in a correct format.
at Microsoft.VisualBasic.CompilerServices.DoubleType.Parse(String Value, NumberFormatInfo NumberFormat)
at Microsoft.VisualBasic.CompilerServices.BooleanType.FromString(String Value)
--- End of inner exception stack trace ---
at Microsoft.VisualBasic.CompilerServices.BooleanType.FromString(String Value)
at gametest.MainForm.Button1Click(Object sender, EventArgs e) in C:\Documents and Settings\Owner\My Documents\SharpDevelop Projects\gametest\MainForm.vb:line 214
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
gametest
Assembly Version: 1.0.2056.17014
Win32 Version: 1.0.2056.17014
CodeBase: file:///C:/Documents%20and%20Settings/Owner/My%20Documents/SharpDevelop%20Projects/gametest/bin/Debug/gametest.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 7.0.5000.0
Win32 Version: 7.10.3052.4
CodeBase: file:///c:/windows/assembly/gac/microsoft.visualbasic/7.0.5000.0__b03f5f7f11d50a3a/microsoft.visualbasic.dll
----------------------------------------
************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
Last edited by xpertsword; Aug 18th, 2005 at 10:27 AM.
-
Aug 18th, 2005, 09:37 AM
#2
Hyperactive Member
Re: Boolean help
Let me say arg!
& is a string append in vb.net !
USE And (or AndAlso, Or, OrElse!)
-
Aug 18th, 2005, 09:45 AM
#3
Re: Boolean help
Yeah, the clue was "FalseFalse" in the second line of that looooooooong error message.
I don't live here any more.
-
Aug 18th, 2005, 09:48 AM
#4
Re: Boolean help
VB Code:
dim playerX as boolean
dim Playerturn as boolean
...
...
...
if playerX and playerturn then
button1.text = "X"
elseif not PlayerX and Playerturn then
button1.text = "O"
Else
button1.text = "err"
I don't live here any more.
-
Aug 18th, 2005, 10:25 AM
#5
Thread Starter
Junior Member
Re: Boolean help
so basically i'm supposed to use 'And' instead of '&' ?
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
|