Ok, first of all, hi everyone at Daniweb! This is my first post on this amazing site and I'am building a little application that checks at load up if a text file is empty, and if it's empty a FolderBrowserDialog will pop up and let you choose a path wich goes into the textfile. But either or not the FolderBrowserDialog pops up and the text file is cleared.
Here's a bit of the code:
FileInfo fi = new FileInfo(@"C:\Users\Sebastian\Desktop\Konvererare BinärDecimal\Konvererare BinärDecimal\bin\Debug\path.cfg");
StreamWriter sw = new StreamWriter(@"C:\Users\Sebastian\Desktop\Konvererare BinärDecimal\Konvererare BinärDecimal\bin\Debug\path.cfg");
if (checkBox1.Checked)
{
if (fi.Length < 3)
{
FolderBrowserDialog fol = new FolderBrowserDialog();
fol.ShowDialog();
sw.WriteLine(fol.SelectedPath);
sw.Close();
}
}
Even if the file does contain text the FolderBrowserDialog pops up...