Utterly stupid error in VS.NET "Illegal characters in path."

I have an OpenFileDialog control on my main form. I was setting the default filename in the properties window and included an * by mistake, and now the property value field contains "Illegal characters in path" and I can't change it. I also can't delete the control. Whichever brilliant MS programmer came up with that idea should be shot. How can I fix or get rid of this ruined control?

Also, the Filter property on the control doesn't seem to be working. It contains:

"DVD Database Files (*.dvd)|*.dvd"

When the open dialog appears, DVD Database Files (*.dvd) is shown in the filter combo box at the bottom, but there are no files visible in the directory. I have several files with this extension in there, so something is wrong here. Same thing applies to my SaveFileDialog. Can anyone tell me what's wrong with this?


  • Hi,

    To get rid of the error, switch to code view and expose the Windows Generated Code. Remove these two lines.

    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
    Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
    'or whatever you named the OpenFileDialog

    When you're entering the filter, are you including the double quotes? If you enter the filter as...

    DVD Database Files (*.dvd)|*.dvd

    it *should* work.

    Hope that helps,


  • Thanks, I got the control fixed. Also, I did have the quotes around the filter string, which apparently was the problem. That also works now.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!