CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Jun 2012
    Posts
    2

    empty path name is not legal Error

    im working on a notepad application when i click on open or save command n after click on cancel in opendialoge box i got error.


    Code:
     private void openToolStripMenuItem_Click(object sender, EventArgs e)
            {
                OpenFileDialog dlg = new OpenFileDialog();
                dlg.Title = "Open";
                dlg.Filter = "Text Documents(*.*)|*.*|All Files(*.*)|*.*";
                dlg.ShowDialog();
                richTextBox1.LoadFile(dlg.FileName);
     
            }
     
            private void saveToolStripMenuItem_Click(object sender, EventArgs e)
            {
                SaveFileDialog dlg = new SaveFileDialog();
                dlg.Title = "Open";
                dlg.Filter = "Text Documents(*.*)|*.*|All Files(*.*)|*.*";
                dlg.ShowDialog();
                richTextBox1.SaveFile(dlg.FileName);
            }

  2. #2
    Join Date
    Dec 2008
    Posts
    144

    Re: empty path name is not legal Error

    You should check your ShowDialog(); calls return values in order to find out which button was actually pressed.

    Something like that
    Code:
    ......................................
    // Show dlg as a modal dialog and determine if DialogResult = OK.
    if (dlg.ShowDialog() == DialogResult.OK)
    {
    ...............................
    }

  3. #3
    Join Date
    Jun 2012
    Posts
    2

    Re: empty path name is not legal Error

    thx

Tags for this Thread

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

Featured