CSV file based on timer event
-
This works, but it seems a bit flakey. Also, does anyone know how to limit the file size?
using (StreamWriter writer = new StreamWriter("C:\\log.csv", true)) //add ,true to this to append
{
writer.WriteLine(textBox1.Text + "," + System.DateTime.Now);}
mprice214 wrote:
This works, but it seems a bit flakey.
Define "flakey". Remember, a
Timer
is only one way to go. You could also use a background thread. In this case, be sure to handle concurrent access of UI (and other) data. /raviMy new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
mprice214 wrote:
This works, but it seems a bit flakey.
Define "flakey". Remember, a
Timer
is only one way to go. You could also use a background thread. In this case, be sure to handle concurrent access of UI (and other) data. /raviMy new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
No problem[^]. :-D
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Prolific encyclopedia fixture proof-reader browser patron addict?
We all depend on the beast below.
-
No problem[^]. :-D
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Prolific encyclopedia fixture proof-reader browser patron addict?
We all depend on the beast below.
-
No problem[^]. :-D
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Prolific encyclopedia fixture proof-reader browser patron addict?
We all depend on the beast below.
:) OT: I wished I lived in Belgium. It's a collector's haven for Dinky Toys. /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
Luc is just having some fun at our expense. :) /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
:) OT: I wished I lived in Belgium. It's a collector's haven for Dinky Toys. /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
Ravi Bhavnani wrote:
collector's haven for Dinky Toys
is it? I wasn't aware, I haven't seen one for ages. I am a model railroad enthusiast myself (N gauge, i.e. scale 1:160). :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Prolific encyclopedia fixture proof-reader browser patron addict?
We all depend on the beast below.
-
Ravi Bhavnani wrote:
collector's haven for Dinky Toys
is it? I wasn't aware, I haven't seen one for ages. I am a model railroad enthusiast myself (N gauge, i.e. scale 1:160). :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Prolific encyclopedia fixture proof-reader browser patron addict?
We all depend on the beast below.
-
Great. The very first image[^] I looked at has a bill board for a shop in Ghent that is still there; I have bought some locs there once. Normally I go shopping in Germany... :) PS: may I suggest you add some navigation to your catalogs, moving to the next/previous page would increase the "user experience".
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Prolific encyclopedia fixture proof-reader browser patron addict?
We all depend on the beast below.
-
Hi all, I've been looking for a way to write data to a CSV file based on a timer event, without success. Is there a standard .NET class that will do this? Thanks.
Sounds like you are doing some profiling/tracing. Google those terms, perhaps in combination with "C#" and anything more specific you are interested in. Or do as others say and create a timer that appends to the CSV file.
-
Hi all, I've been looking for a way to write data to a CSV file based on a timer event, without success. Is there a standard .NET class that will do this? Thanks.
Hi boy, try this. :)
using System; using System.Windows.Forms; using System.IO; namespace WriteCSV { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { this.timer1.Enabled = !this.timer1.Enabled; } private void timer1_Tick(object sender, EventArgs e) { FileStream fs = new FileStream("test.csv", FileMode.Append, FileAccess.Write); StreamWriter sw = new StreamWriter(fs); sw.WriteLine(DateTime.Now.ToString()); sw.Close(); fs.Close(); } } }