473,624 Members | 2,298 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What makes this code slow

This code resets a form with two cbo's (comboBoxes) and one datagrid.
The first cbo (cboSelection) selects a main table and filters the
second cbo. The second cbo (cboView) selects the secondary table which
determine the dataAdapter used to fill the dataGrid. Both cbo's are
populated by filling dataAdapters.

This code just empty's the datagrid, cbo's and dataset so the user can
start over to view another set of data.

\\
Private Sub btnResetForm_Cl ick(ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles btnResetForm.Cl ick

'Clear the datagrid
Me.DataGrid1.Da taSource = Nothing
Me.DataGrid1.Ta bleStyles.Clear ()

'clear the dataset
_dataSet1.Clear ()

DAL.da010JobFrm .Fill(_dataSet1 , "tbl010Job" )

'cboSelection
Me.cboSelection .DataSource = _dataSet1
Me.cboSelection .DisplayMember = "tbl010Job.JobN umber"
Me.cboSelection .ValueMember = "tbl010Job.pkJo bId"

_bStillLoadingC boSelection = False

_bStillLoadingC boView = True

End Sub
//

What makes this code slow?

It is as slow as if it was about to throw an error.

Or How can I test this code?

Thank you,
dbuchanan

Nov 21 '05 #1
13 2131
Data binding is slow. I'd bet you could
load the combobox faster with your own code.

Did you try trapping errors and see if
one is being generated?

--
Robbe Morris - 2004/2005 Microsoft MVP C#
EggHeadCafe's RSS Search Engine
http://www.eggheadcafe.com/articles/...h/default.aspx


"dbuchanan" <db*********@ho tmail.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
This code resets a form with two cbo's (comboBoxes) and one datagrid.
The first cbo (cboSelection) selects a main table and filters the
second cbo. The second cbo (cboView) selects the secondary table which
determine the dataAdapter used to fill the dataGrid. Both cbo's are
populated by filling dataAdapters.

This code just empty's the datagrid, cbo's and dataset so the user can
start over to view another set of data.

\\
Private Sub btnResetForm_Cl ick(ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles btnResetForm.Cl ick

'Clear the datagrid
Me.DataGrid1.Da taSource = Nothing
Me.DataGrid1.Ta bleStyles.Clear ()

'clear the dataset
_dataSet1.Clear ()

DAL.da010JobFrm .Fill(_dataSet1 , "tbl010Job" )

'cboSelection
Me.cboSelection .DataSource = _dataSet1
Me.cboSelection .DisplayMember = "tbl010Job.JobN umber"
Me.cboSelection .ValueMember = "tbl010Job.pkJo bId"

_bStillLoadingC boSelection = False

_bStillLoadingC boView = True

End Sub
//

What makes this code slow?

It is as slow as if it was about to throw an error.

Or How can I test this code?

Thank you,
dbuchanan

Nov 21 '05 #2
Hi Robbe,

Thank you for your reply.

I use the binding all over in my code for comboBoxes and it appears
instantaneous. This block of code is *exceptionally* slloooooowwww!

There is one thing I do a little differently in this block compared to
others but it raised no flags with me for reasons I will explain.

In other code I clear a dataTable with code like this;

'clear the datatable
_dataSet1.tbl04 0Cmpt.Clear()

but in this block I clear the entire dataset with this code;

'clear the dataset
_dataSet1.Clear ()

This has not reaised any flags for me (#1) because there are only a
coulple of tables involved. The reason I clear the dataset instead of
tables is that I don't know which tables it will be - it depends on
user selection.

Another reason (#2) that it has not raised a flag with me is that
subsequaint calls to this block are instantaneous even though the same
numbers of tables are loaded.

Any clues to what might cause this type of behavior?
Did you try trapping errors and see if one is being generated?


I put this block within a try catch block. That did not bring up any
errors. Is there another way to expose errors that I might get me more
results - I'm sort-of new at trapping errors.

Thank you,
dbuchanan

Nov 21 '05 #3
DAL.da010JobFrm .Fill(_dataSet1 , "tbl010Job" )
--
Robbe Morris - 2004/2005 Microsoft MVP C#
Free Source Code for ADO.NET Object Mapper To DataBase Tables And Stored
Procedures
http://www.eggheadcafe.com/articles/..._generator.asp


"dbuchanan" <db*********@ho tmail.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
This code resets a form with two cbo's (comboBoxes) and one datagrid.
The first cbo (cboSelection) selects a main table and filters the
second cbo. The second cbo (cboView) selects the secondary table which
determine the dataAdapter used to fill the dataGrid. Both cbo's are
populated by filling dataAdapters.

This code just empty's the datagrid, cbo's and dataset so the user can
start over to view another set of data.

\\
Private Sub btnResetForm_Cl ick(ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles btnResetForm.Cl ick

'Clear the datagrid
Me.DataGrid1.Da taSource = Nothing
Me.DataGrid1.Ta bleStyles.Clear ()

'clear the dataset
_dataSet1.Clear ()

DAL.da010JobFrm .Fill(_dataSet1 , "tbl010Job" )

'cboSelection
Me.cboSelection .DataSource = _dataSet1
Me.cboSelection .DisplayMember = "tbl010Job.JobN umber"
Me.cboSelection .ValueMember = "tbl010Job.pkJo bId"

_bStillLoadingC boSelection = False

_bStillLoadingC boView = True

End Sub
//

What makes this code slow?

It is as slow as if it was about to throw an error.

Or How can I test this code?

Thank you,
dbuchanan

Nov 21 '05 #4
Hi Robbe,

The code takes a full five seconds on the first call. It is
instantaneous on each call thereafter.

1.) open the windows form
2.) select the job in the first comboBox
3.) select the view in the second comboBox
.... view the data in the datagrid
4.) Click the Reset button to make another selection
....
....
....
....
.... wait a ful 5 seconds for the form to reset (datagrid and combo
boxes are cleared and reset)
5.) select the job in the first comboBox
6.) select the view in the second comboBox
.... view the data
7.) Click the Reset button
instantaneous reset ready for the user to begin another selection.

Thank you,
dbuchanan

Nov 21 '05 #5
dbuchanan,

Deleting datarows is extremely slow in the version 1.x. This is one of the
points that was especially a point for improvement in 2.0.

I don't know how that affects the clear.

However, why don't you try what creating a new dataset does. The old one
will be automaticly than be deleted by the GC when there is a better time
for that.

I hope this helps,

Cor
Nov 21 '05 #6
Cor, Robbe, Anybody,
Deleting datarows is extremely slow in the version 1.x.


I don't think we're on the right track. - The problem exists only in
this form's clear and only the first time. It is clearing the same
amount of data the second time.

How can I go about detecting what is happening in this code? Or where
exactly the bottleneck is?

Stepping through the code in debug mode is not good enough. It only
shows what I know already... When I step past "_dataSet1.Clea r()" the
first time there is a long delay. after populating the form again and
clicking the "reset" button the second time a step past
"_dataSet1.Clea r()" is instantaneous. Why? Why does it take so long the
first time? Why is it no problem the second time an all times
thereafter? There *is* a reason! How can I track it down?

Thank you,
dbuchanan

Nov 21 '05 #7
dbuchanan,

Can it be that the dataset is already empty in this case. I thought to
remember me that I have seen that in version 1.x the exception is used to
check that.

That could than explain the situation.

Cor
Nov 21 '05 #8
On 2005-09-18, dbuchanan <db*********@ho tmail.com> wrote:
Cor, Robbe, Anybody,
Deleting datarows is extremely slow in the version 1.x.
I don't think we're on the right track. - The problem exists only in
this form's clear and only the first time. It is clearing the same
amount of data the second time.

How can I go about detecting what is happening in this code? Or where
exactly the bottleneck is?


Two thoughts. Attach handlers to the various dataset and datatable
events, to see if you can narrow down exactly where the delay is.

Even more useful probably, go into Debug-Exceptions and set all CLR
exceptions to break into the debugger. This should tell you if
the first Clear is throwing exceptions for some reason.

Also, do you have the same delay if you aren't running in DEBUG mode?
That would be a good sign of exceptions, since exceptions are much, much
slower in a debugger.


Stepping through the code in debug mode is not good enough. It only
shows what I know already... When I step past "_dataSet1.Clea r()" the
first time there is a long delay. after populating the form again and
clicking the "reset" button the second time a step past
"_dataSet1.Clea r()" is instantaneous. Why? Why does it take so long the
first time? Why is it no problem the second time an all times
thereafter? There *is* a reason! How can I track it down?

Thank you,
dbuchanan

Nov 21 '05 #9
Hi David,

I'm kinda new at this debugging thing...
Attach handlers to the various dataset and datatable events
Could you give me an example of how to do this?
go into Debug-Exceptions and set all CLR exceptions to break into the debugger
Could you explain to me how to navigate to this and what to do when I
get there?
do you have the same delay if you aren't running in DEBUG mode?


The delay in Release mode seems to actually run a little longer than in
DEBUG mode (by about one second).

Thank you,
dbuchanan

Nov 21 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
2576
by: Jason | last post by:
Hey, I'm an experience programmer but new to Python. I'm doing a simple implementation of a field morphing techinique due to Beier and Neely (1992) and I have the simple case working in Python 2.3 - but it's REALLY slow. Basically, you specify two directed line segments in the coordinate system of a raster image and use the difference between those two lines to transform the image.
92
6431
by: Reed L. O'Brien | last post by:
I see rotor was removed for 2.4 and the docs say use an AES module provided separately... Is there a standard module that works alike or an AES module that works alike but with better encryption? cheers, reed
137
7051
by: Philippe C. Martin | last post by:
I apologize in advance for launching this post but I might get enlightment somehow (PS: I am _very_ agnostic ;-). - 1) I do not consider my intelligence/education above average - 2) I am very pragmatic - 3) I usually move forward when I get the gut feeling I am correct - 4) Most likely because of 1), I usually do not manage to fully explain 3) when it comes true. - 5) I have developed for many years (>18) in many different environments,...
17
1790
by: ilPostino | last post by:
Hey, My experience with c++ is limited to ATL and for the past 3 years it's just been c#. I need to write a UI intensive application that is just too slow in managed code. So I'm re-doing it in unmanaged c++, what should I use in vc++ 7, ATL, MFC or Win32? thanks Craig
13
5032
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
15
2052
by: jim | last post by:
Maybe I'm missing something, but it doesn't look like Microsoft writes a lot of apps in .Net (although they certainly push it for others). What does MS write using pure .Net? If applications like Symantec's antivirus, NeatReciepts or Franklin Covey's PlanPlus for Windows is any guide, .Net applications are slow and clunky. But, maybe the developers of these apps simply don't know how to write a decent app with .Net.
184
6997
by: jim | last post by:
In a thread about wrapping .Net applications using Thinstall and Xenocode, it was pointed out that there may be better programming languages/IDEs to use for the purpose of creating standalone, single executable apps. My goal is to create desktop applications for use on Windows XP+ OSs that are distributed as single executables that do not require traditional install packages to run. I would like to use a drag and drop UI development...
20
2784
by: mc | last post by:
I may be opening a can of worms and don't want to start a religious war, but... What features of Java do Java programmers miss when working in C#? Other than, of course, great portability. C# has more limited cross-platform portability (Mono). I'm thinking more about data structures and ways to express algorithms.
6
13846
by: Juha Nieminen | last post by:
I tested the speed of a simple program like this: //------------------------------------------------------------ #include <list> #include <boost/pool/pool_alloc.hpp> int main() { typedef std::list<intList_t; // default allocator //typedef std::list<int, boost::pool_allocator<int List_t;
0
8177
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8681
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8629
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8341
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8488
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4183
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1793
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.