String was not recognized as a valid Boolean

C

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(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.WndProc(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
 
P

Phillip Taylor

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(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.WndProc(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
 
P

Phill W.

c2 said:
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.
 
R

rowe_newsgroups

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(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.WndProc(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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top