Hi all,
I am trying to write a class file, but am not quite sure what I am doing.
What I want to do is from within an ASP page is to call a class.
The class must then create a text file (using StreamWriter).
I then need to pass various information to the class, then eventually close
the file and send it out to the calling page.
I am thinking something like...
namespace MyClass
{
public class writeFile
{
private string FileName = "";
public string MyFile
{
get ...
set ...
}
public StreamWriter WriteFile(StreamWriter myStream)
{
new StreamWriter(MyFile);
}
public void AddText(string MyText)
{
MyFile.Write(MyText);
}
public void AddSignature()
{
MyFile.Write("Dave Colliver");
}
public void CloseFile()
{
MyFile.Close();
}
}
}
I know the above is wrong but it is to give you an idea of what I want. From
the ASPX file, I will need to do something like...
writeFile wf = new writeFile();
writeFile.MyFile = "c:\dave.txt";
writeFile.AddText("Learning to write a class file");
writeFile.AddSignature();
writeFile.Save(MyFilename);
// Thinking about the above, I won't need to set MyFile value, but I think
you get the picture...
Can someone point me in the right direction. I have tried googling but
unfortunately, I can't get my search query fine tuned enough to return a
decent result.
Thanks for your help.
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available