I simply want to write data from a listBox to a textfile. The name of the textfile should include the current date and time.
string filename = String.Concat(string.Format("{0:yyyy-MM-dd}", DateTime.Today), "_", string.Format("{0:HH:mm:ss}", DateTime.Now), ".txt");
System.IO.StreamWriter fs = new System.IO.StreamWriter(filename, false);
foreach (var item in myLbx.Items)
{
fs.WriteLine(item);
}
fs.Close();
When I run this code, I get a NotSupportedException
, saying that the format of my filename is not supported.