Question My programme is very slow

Your question is far too vague. At a guess I'd say that you are performing complex queries and/or returning a lot of data but you should provide a far more detailed explanation of what you're doing and what behaviour you're seeing. I won't be downloading your project except as a last resort.
 
I can't take the time to download your complete project either.
How you are visualizing your data? I am guessing here ...
... if you are using a DataGridView in a Windows Forms application, and it is bound to a DataTable then you need to set the following property:

MyDataGridView.CausesValidation = False

' And when you want to update the "display image":

MyDataGridView.Show()

' Ideally exit your event handler to cause the display to be refreshed by Windows Forms, or if you need to force the GUI update (bad practice):

Application.Doevents()


If the "CausesValidation" property is left as the default value "True" when the DataGridView is bound to a DataTable,
then it will attempt to "redraw" itself for every data item that changes in the DataTable.
This will cause a huge overhead in the graphics driver and eventually your application will grind to a halt and eventually crash.
Another "solution" when updating a DataTable that you want to display in a DataGridView is to unbind the DataTable:

MyDataGridView.DataSource = Nothing

' update MyDataTable here

MyDataGridView.DataSource = MyDataTable
MyDataGridView.Show()

' And then exit the event handler which causes Windows Forms to refresh the GUI, or if you really can not do that (bad practice), then issue:

Application.DoEvents()


Having said this, I was informed by Admins that use of "Application.DoEvents()" is bad practice, but I don't have the level of expertise to
understand why it is "bad practice", nor do I understand what any consequences or problems arising from its use might be. The "point"
of my reply is to suggest that your visualisation technique may be causing the problems of your application grinding to a halt if
the GUI is being "refreshed" at every small change that is made to a bound DataTable or DataSet. So either "unbind" it, or else
make sure that the Visualisation method is not doing these GUI refreshes when you do not intend it to do so.

I hope this might be "helpful" and if so please tick my box!

Thanks,
Rob
 
Back
Top