By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,903 Members | 1,977 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,903 IT Pros & Developers. It's quick & easy.

String was not recognized as a valid Boolean

P: n/a
c2
hi,
i face a problem when click the icon , my login will prompt this
message
String was not recognized as a valid Boolean

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.FormatException: String was not recognized as a valid Boolean.
at System.Boolean.Parse(String value)
at System.Convert.ToBoolean(String value)
at CrossDock.Common.CrossDockFlag.SetSystemFlag()
at CrossDock.frmLogin.Form1_Load(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean
fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m)
at System.Windows.Forms.ContainerControl.WndProc(Mess age& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
the message seems point out Form1_Load has problem, but i don't where
the bug is?

however, when i using ide run the same program , the login page is ok
no error prompt

Please give me comments and thank in advances

Sep 7 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On 7 Sep, 11:58, c2 <szeyee.t...@gmail.comwrote:
hi,
i face a problem when click the icon , my login will prompt this
message
String was not recognized as a valid Boolean

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.FormatException: String was not recognized as a valid Boolean.
at System.Boolean.Parse(String value)
at System.Convert.ToBoolean(String value)
at CrossDock.Common.CrossDockFlag.SetSystemFlag()
at CrossDock.frmLogin.Form1_Load(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean
fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m)
at System.Windows.Forms.ContainerControl.WndProc(Mess age& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
the message seems point out Form1_Load has problem, but i don't where
the bug is?

however, when i using ide run the same program , the login page is ok
no error prompt

Please give me comments and thank in advances
Your English is atrocious but your error is happening under:

frmLogin

on the procedure called: Form1_Load

You are trying to cast a string into a boolean. are you sure your not
doing this:

if ("hello") then

or

if (username) then

instead of (if username = "value") then

You basically comparing a string value to a boolean value. Without
seeing the code I can't tell you which variable is wrong exactly.

Phillip Ross Taylor

Sep 7 '07 #2

P: n/a
c2 wrote:
the message seems point out Form1_Load has problem, but i don't where
the bug is?
Look again:

System.FormatException: String was not recognized as a valid Boolean.
at System.Boolean.Parse(String value)
at System.Convert.ToBoolean(String value)
at CrossDock.Common.CrossDockFlag.SetSystemFlag()
at CrossDock.frmLogin.Form1_Load(Object sender, EventArgs e)

Form1_Load() is calling Common.CrossDock.SetSystemFlag() which is
calling Convert.ToBoolean() to convert a String value into a Boolean
one. Ly guess would be that the String value just happens to be empty
("") at this point.
however, when i using ide run the same program , the login page is ok
no error prompt
Print out (to a file, a MsgBox, or whatever) the value being passed to
Convert.ToBoolean in the SetSystemFlag routine.

If that doesn't give you any clues, post the code in the SetSystemFlag
routine.

HTH,
Phill W.
Sep 7 '07 #3

P: n/a
On Sep 7, 6:58 am, c2 <szeyee.t...@gmail.comwrote:
hi,
i face a problem when click the icon , my login will prompt this
message
String was not recognized as a valid Boolean

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.FormatException: String was not recognized as a valid Boolean.
at System.Boolean.Parse(String value)
at System.Convert.ToBoolean(String value)
at CrossDock.Common.CrossDockFlag.SetSystemFlag()
at CrossDock.frmLogin.Form1_Load(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean
fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m)
at System.Windows.Forms.ContainerControl.WndProc(Mess age& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
the message seems point out Form1_Load has problem, but i don't where
the bug is?

however, when i using ide run the same program , the login page is ok
no error prompt

Please give me comments and thank in advances
While error printouts are nice - what we need is the actual code that
goes into the form load event handler. Also, you should have been able
to add a breakpoint in the method and then step through to find the
exact line that was causing the problem. It also might help you to
turn on Option Strict (just type "Option String On" at the top of the
code file), option strict will stop most of these implicit castings
which lead to runtime exceptions.

Thanks,

Seth Rowe

Sep 7 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.