File Path Problem

I have a SaveFileDialog that I use to get create or overwrite an XML file which is giving me some issues. It seems that whenever I have to bring up the dialog box, and I make the file name and save it, the directory path I saved the file to gets "stuck" in the file stream. Then if I do something like:

File.WriteAllText("config.dat", "SomeArbitraryStringCharacters");

It wants to create the config.dat file in the same directory I saved the XML file into, even though they're totally unrelated! Whats up with that? Is there some secret way to remove this file path from the underlying stream or something?

This is the code I use to create the XML file:

private void XMLSaveFileDialog_FileOk(object sender, EventArgs e)
{
try
{
XMLFilePath = XMLSaveFileDialog.FileName;
File.Create(XMLFilePath);
}
catch (Exception error)
{
MessageBox.Show("Error: " + Convert.ToString(error.Message), "Notice", MessageBoxButtons.OK);
}
}

Such a bizarre problem and I cant seem to find anyway to get rid of it.
[1231 byte] By [RaleTheBlade] at [2007-11-20 11:03:15]
# 1 Re: File Path Problem
Nevermind, I fixed it. Just reset the current working directory to the directory of the executable where it should be. Kinda weird the way that works but whatever, lol.

Though my question is still valid... Why does the SaveFileDialog change the current working directory?
RaleTheBlade at 2007-11-9 11:36:11 >