Extremle bad performance of DataGridView... :-\

  • Thread starter Thread starter Dmitry Bond.
  • Start date Start date
D

Dmitry Bond.

Hello.

Could you please help?

Source: VS2005, .NET 2.0, simple windows application, a number of
*.XML files (sometimes with + *.XSD).

Idea - display DataSet data which was previously stored to XML file
(with DataSet.WriteXml method).
So, the main form has a DataGridView -> BindingSource -> DataSet
objects linked together.
And there is only one button - LoadXml:

private void tbLoadData_Click(object sender, EventArgs e)
{
if (dlgOpen.ShowDialog() != DialogResult.OK) return;

this.dataSet1.ReadXml(dlgOpen.FileName);
string alt_fn = Path.ChangeExtension(dlgOpen.FileName,
".xsd");
if (File.Exists(alt_fn))
this.dataSet1.ReadXmlSchema(alt_fn);

this.bindingSource1.DataMember = this.dataSet1.Tables
[0].TableName;
this.bindingSource1.ResetBindings(true);
this.dataGridView1.Refresh();
this.dataGridView1.Parent.Refresh();
stLab2.Text = string.Format("{0} data rows x {1} columns",
this.dataSet1.Tables[0].Rows.Count,
this.dataSet1.Tables[0].Columns.Count);
}

Of course all XML files has different set of fields (different
schemes) but all of them were stored from .NET applications with
DataSet.WriteXml method (sometimes it also store scheme file near -
but it is optional).

Unfortunately this code does not work. :-\

Question - how to make it working?!
Can you recommend some manuals, guides to read? I mean - guides
exactly about data binding/data displaying. Seems this part in .NET is
extremely tricky and unclear... :-(


--------
Ok. Next problem - performance problem.
I found a way how to display dataset loaded from XML - in the middle
of code listed above I have added this part:

this.dataGridView1.Columns.Clear();
foreach (DataColumn dc in dataSet1.Tables[0].Columns)
{
DataGridViewColumn dgc = new DataGridViewColumn(new
DataGridViewTextBoxCell());
dgc.Name = dc.ColumnName;
dgc.DataPropertyName = dc.ColumnName;
this.dataGridView1.Columns.Add(dgc);
}

So, I recreated columns for DataGridView and now it able to display
data correctly each time I load it from XML.
BUT IS IT EXTREMELY SLOW! I have only 700 rows in DataGridView but it
slowsdowns my computer like there are 700.000 rows (comparing to
normal Win32 applications performance).

So, question is - WHY DataGridView is SO SLOW?
What can I do to make it fast?
What is wrong in my code? In approach I implemented?


Regards,
Dmitry.
 
As nobody answered, so I put some summary on my investigations.

The only pattern I found - performance problems appears only with
nVidia video cards, thus it is something related to hardware problems.
Seems after latest patches problem was fixed under Windows Vista, but
under Windows XP problem still exists.
And seems there is no chances to have it fixed for WinXP, looks like
it is "politic" of microsoft - to enforce everybody to "migrate" to
Vista.

Last time, when I did show that .NET application to a customer and
explained possible reasons of problem they decided to freeze migration
to .NET platform for some time. Until MS fix this performance bug or
until they have all computers with Vista...

Thus, my conclusion - problem exists. Seems MS fixed it for Windows
Vista but still not fixed for Windows XP.
Recommendation from MS insiders was like this - "buy a license for
specialized visual controls for your development and do not expect
that visual controls pre-included into Visual Studio will be working
ok".



Hello.

Could you please help?

Source: VS2005, .NET 2.0, simple windows application, a number of
*.XML files (sometimes with + *.XSD).
[...]
 
Dmitry Bond. said:
As nobody answered, so I put some summary on my investigations.

The only pattern I found - performance problems appears only with
nVidia video cards, thus it is something related to hardware problems.
Seems after latest patches problem was fixed under Windows Vista, but
under Windows XP problem still exists.
And seems there is no chances to have it fixed for WinXP, looks like
it is "politic" of microsoft - to enforce everybody to "migrate" to
Vista.

Last time, when I did show that .NET application to a customer and
explained possible reasons of problem they decided to freeze migration
to .NET platform for some time. Until MS fix this performance bug or
until they have all computers with Vista...

Thus, my conclusion - problem exists. Seems MS fixed it for Windows
Vista but still not fixed for Windows XP.
Recommendation from MS insiders was like this - "buy a license for
specialized visual controls for your development and do not expect
that visual controls pre-included into Visual Studio will be working
ok".



Hello.

Could you please help?

Source: VS2005, .NET 2.0, simple windows application, a number of
*.XML files (sometimes with + *.XSD).
[...]

Was it fixed in Vista (the NVidia unique problem) with new drivers, by any
chance?
If so, have you checked with NVidia for updated XP drivers?
 
Back
Top