Results 1 to 7 of 7

Thread: Error when showing a form..

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Posts
    16

    Error when showing a form..

    When i use the code:

    frmRegister.Show()

    I get this error when it attempts to show the form:

    An error occurred creating the form. See Exception.InnerException for details. The error is: Illegal characters in path.

    How can i get rid of this error? I only want to show a form...

    Regards.

  2. #2
    Lively Member
    Join Date
    May 2008
    Posts
    75

    Re: Error when showing a form..

    Quote Originally Posted by Whack-A-Mole.NET View Post
    When i use the code:

    frmRegister.Show()

    I get this error when it attempts to show the form:

    An error occurred creating the form. See Exception.InnerException for details. The error is: Illegal characters in path.

    How can i get rid of this error? I only want to show a form...

    Regards.
    can you create a replication project? and post it for us to download and try?

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: Error when showing a form..

    The error suggests that there is a path involved. Is there? If so, post that.
    My usual boring signature: Nothing

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Posts
    16

    Re: Error when showing a form..

    Path? I'm just showing the form.

    Below is the 'Exception in detail':

    System.InvalidOperationException was unhandled
    Message="An error occurred creating the form. See Exception.InnerException for details. The error is: Illegal characters in path."
    Source="Whack-A-Mole.NET"
    StackTrace:
    at Whack_A_Mole.NET.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
    at Whack_A_Mole.NET.My.MyProject.MyForms.get_frmRegister()
    at Whack_A_Mole.NET.frmMain.frmMain_Load(Object sender, EventArgs e) in C:\Documents and Settings\Administrator\My Documents\Mjwsoft\Whack-A-Mole.NET\Whack-A-Mole.NET\Whack-A-Mole.NET\frmMain.vb:line 54
    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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
    at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
    at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
    at System.Windows.Forms.Control.set_Visible(Boolean value)
    at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
    at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
    at System.Windows.Forms.Application.Run(ApplicationContext context)
    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
    at Whack_A_Mole.NET.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
    at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
    at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Threading.ThreadHelper.ThreadStart()
    InnerException: System.ArgumentException
    Message="Illegal characters in path."
    Source="mscorlib"
    StackTrace:
    at System.IO.Path.CheckInvalidPathChars(String path)
    at System.IO.Path.GetFileName(String path)
    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
    at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
    at System.IO.StreamReader..ctor(String path)
    at Whack_A_Mole.NET.frmRegister..ctor() in C:\Documents and Settings\Administrator\My Documents\Mjwsoft\Whack-A-Mole.NET\Whack-A-Mole.NET\Whack-A-Mole.NET\frmRegister.vb:line 3
    InnerException:

    Regards.

  5. #5
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Error when showing a form..

    This part is the interesting one:

    StackTrace:
    at System.IO.Path.CheckInvalidPathChars(String path)
    at System.IO.Path.GetFileName(String path)
    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
    at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
    at System.IO.StreamReader..ctor(String path)
    at Whack_A_Mole.NET.frmRegister..ctor() in C:\Documents and Settings\Administrator\My Documents\Mjwsoft\Whack-A-Mole.NET\Whack-A-Mole.NET\Whack-A-Mole.NET\frmRegister.vb:line 3


    You appear to be creating a StreamReader somewhere when you create/display the form. And by the sound of the exception, you're passing an invalid path to its constructor.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Posts
    16

    Re: Error when showing a form..

    I removed line 3 and it seems to work. I was declaring a StreamReader there.

    Regards.

  7. #7
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Error when showing a form..

    Good to hear you got it working.
    Please mark the thread as resolved using the thread tools menu at the top of this thread, if you've got no more questions on this topic
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width