Saving text file with StreamWriter
-
Anytime I open or save a .css file using RichTextBox.LoadFile() or .SaveFile() methods Frontpage opens the file. So I write the contents to disk using the following. Even so, Frontpage still tries to open the file!
try
{
using (StreamWriter writer = File.CreateText(path))
{
foreach (string line in rich.Lines)
writer.WriteLine(line);
}
}
catch (IOException e)
{
// error handling here
}Mark
-
Anytime I open or save a .css file using RichTextBox.LoadFile() or .SaveFile() methods Frontpage opens the file. So I write the contents to disk using the following. Even so, Frontpage still tries to open the file!
try
{
using (StreamWriter writer = File.CreateText(path))
{
foreach (string line in rich.Lines)
writer.WriteLine(line);
}
}
catch (IOException e)
{
// error handling here
}Mark
Huh, bummer.
-
Anytime I open or save a .css file using RichTextBox.LoadFile() or .SaveFile() methods Frontpage opens the file. So I write the contents to disk using the following. Even so, Frontpage still tries to open the file!
try
{
using (StreamWriter writer = File.CreateText(path))
{
foreach (string line in rich.Lines)
writer.WriteLine(line);
}
}
catch (IOException e)
{
// error handling here
}Mark
-
If you have the web site open in Frontpage it will watch for file changes. It doesn't matter how you write the file, you can't change it without changing it...
Despite everything, the person most likely to be fooling you next is yourself.
-
Frontpage is not running, and I am simply editing a .css document (text) in a RichTextBox. I doesn't make any sense that Frontpage opens after the file is saved in the RichTextBox control! Mark
No, that doesn't make sense. Applications doesn't start by themselves, so it seems that you start the css file somehow, causing Frontpage to open... Do you do anything more when loading or saving the file? I suppose that you create the css file for some reason, so what do you do with it?
Despite everything, the person most likely to be fooling you next is yourself.
-
No, that doesn't make sense. Applications doesn't start by themselves, so it seems that you start the css file somehow, causing Frontpage to open... Do you do anything more when loading or saving the file? I suppose that you create the css file for some reason, so what do you do with it?
Despite everything, the person most likely to be fooling you next is yourself.