المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : C# XML text file won't save to Desktop or MyDocuments



C# Programming
09-11-2009, 10:42 PM
Good afternoon.

The following code creates a text file at any ******** except to the Desktop or MyDocuments. It is desgined to save to a flash drive primarily, but it tests for the absence of the FD and will save to another ********.


DialogResult dr = fbd.ShowDialog();
//fbd.
if (dr == DialogResult.OK)
{
strFolderName = fbd.SelectedPath;

SW = File.CreateText(strFolderName + strFileName);

foreach (XElement xe in Results.Descendants())
{
if (xe.HasElements)
{
foreach (XElement xeDesc in xe.Descendants())
{
if (xeDesc.Value != null)
{
SW.WriteLine(xeDesc.Value);
}
}
}
}
SW.Close();



Can't seem to figure out why it won't save to those ********s. I did a little test text file (using TextWriter) and it worked.

Any suggestions? WHEELS