V
Vincitori
Hallo,
I have a method which populates a dataGridView:
public void fillTest4DataGridView ()
{
this.dataGridView1.Rows.Clear ();
Random rand = new Random ();
for (int j = 0; j < 5; j++)
{
this.dataGridView1.Rows.Add (200);
for (int i = 0; i < 200; i++)
{
this.dataGridView1.Rows[i + (j * 200)].Cells[0].Value =
Resources.wait;
this.dataGridView1.Rows[i + (j * 200)].Height = 60;
this.dataGridView1.Rows[i + (j * 200)].Cells[1].Value =
(i + (j * 200)) + " hjgzttchjgvukjtg7zug";
this.dataGridView1.Rows[i + (j * 200)].Cells[2].Value =
"123153485489";
this.dataGridView1.Rows[i + (j * 200)].Cells[3].Value =
"ioziuhfvzuf67f ugui ";
this.dataGridView1.Rows[i + (j * 200)].Cells[4].Value =
"ih 89z8h 8u z76 hjg";
this.dataGridView1.Rows[i + (j * 200)].Cells[5].Value =
DateTime.Now.AddSeconds (rand.Next (10000));
this.dataGridView1.Rows[i + (j * 200)].Cells[6].Value =
rand.Next (1, 20000).ToString ("N0");
}
Application.DoEvents ();
}
}
Every time I call this method the memory the program uses increases by
50MB. I tried calling this.dataGridView1.Dispose(); to free the
memory, but that didn't help either.
Does anybody know what I can do to free the memory used?
Thank you,
- Vincent
I have a method which populates a dataGridView:
public void fillTest4DataGridView ()
{
this.dataGridView1.Rows.Clear ();
Random rand = new Random ();
for (int j = 0; j < 5; j++)
{
this.dataGridView1.Rows.Add (200);
for (int i = 0; i < 200; i++)
{
this.dataGridView1.Rows[i + (j * 200)].Cells[0].Value =
Resources.wait;
this.dataGridView1.Rows[i + (j * 200)].Height = 60;
this.dataGridView1.Rows[i + (j * 200)].Cells[1].Value =
(i + (j * 200)) + " hjgzttchjgvukjtg7zug";
this.dataGridView1.Rows[i + (j * 200)].Cells[2].Value =
"123153485489";
this.dataGridView1.Rows[i + (j * 200)].Cells[3].Value =
"ioziuhfvzuf67f ugui ";
this.dataGridView1.Rows[i + (j * 200)].Cells[4].Value =
"ih 89z8h 8u z76 hjg";
this.dataGridView1.Rows[i + (j * 200)].Cells[5].Value =
DateTime.Now.AddSeconds (rand.Next (10000));
this.dataGridView1.Rows[i + (j * 200)].Cells[6].Value =
rand.Next (1, 20000).ToString ("N0");
}
Application.DoEvents ();
}
}
Every time I call this method the memory the program uses increases by
50MB. I tried calling this.dataGridView1.Dispose(); to free the
memory, but that didn't help either.
Does anybody know what I can do to free the memory used?
Thank you,
- Vincent