473,549 Members | 3,099 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Updating dataset using thread ... CPU taking lot of time..Need Help

Hello all,

I have a third praty grid control...named C1grid. Im using it in one of
my apps..
Now, I have bind this grid to a custom dataset class named
"DataViewEx ".
The code of the class is below...

Now what happens is that im updating this dataviewex class from a
separate thread.....
And then the grid is updated using invoke method.

But here comes the problem....
This app is real time...and there is lots of data coming at a very fast
rate....
And when the updation of dataviewex class takes place the cpu takes a
lot of time.....
And in certain cases it even hangs.....takin g almost 100 CPU time...

So my question is that

1) Is it happening because of invoke...Or what is the problem....Why is
the CPU hanigng...
Whats causing the CPU to take such a long time.....

Please any suggestions....

Thanks,
Cheers..

Bye.

The code of the class is below....

using System;
using System.Data;
using System.Componen tModel;

namespace AAA
{
public class DataViewEx : DataView
{
private C1FlexGrid m_fgrdDataGrid;

public DataViewEx(C1Fl exGrid fgrdDataGrid) : base()
{
m_fgrdDataGrid = fgrdDataGrid;
}

private delegate void OnListChangedDe legate(ListChan gedEventArgs e);

protected override void OnListChanged(L istChangedEvent Args e)
{
if ( m_fgrdDataGrid != null && m_fgrdDataGrid. InvokeRequired )
{
m_fgrdDataGrid. Invoke( new OnListChangedDe legate( OnListChanged ),
new object[]{e} );
}
else
base.OnListChan ged(e);
}

private delegate void IndexListChange dDelegate(objec t sender,
ListChangedEven tArgs e);

protected override void IndexListChange d(object sender,
ListChangedEven tArgs e)
{
if ( m_fgrdDataGrid != null && m_fgrdDataGrid. InvokeRequired )
{
m_fgrdDataGrid. Invoke( new IndexListChange dDelegate(
IndexListChange d ), new object[]{ sender, e } );
}
else
base.IndexListC hanged( sender, e );
}
}
}

Jul 6 '06 #1
1 1955
Hi,

You could try replacing "Invoke" with "BeginInvok e".

BeginInvoke is usually better, because it allows the backgroundthrea d to
continue its work instead of waiting for the UI thread to perform the update.

There is lots of data coming very fast, is that continuously, or now and then?
If is it continuously, then maybe it would be better to just update the
screen every 200 milliseconds, or faster or slower (I don't know the
requirements).

If it is not continuously, you could refdresh the screen with a small delay,
thus resulting in fewer updates of the screen. I'll explain this a little
better:
If let's say every 5 seconds you have 20 parts of new data with 20 ms
interval, then 5 seconds "silence", and again multiple updates. If, instead
of updating the screen every time new data arrives, you start a timer
(interval 100 ms, for example), and when the timer elapses, then start the
update. This could result in fewer updates, every time showing multiple
parts of your new data.

These are techniques I have used in the past to improve the user experience
when fast screen updates where causing performance problems.

Hope this helps,

Joris
"batista" wrote:
Hello all,

I have a third praty grid control...named C1grid. Im using it in one of
my apps..
Now, I have bind this grid to a custom dataset class named
"DataViewEx ".
The code of the class is below...

Now what happens is that im updating this dataviewex class from a
separate thread.....
And then the grid is updated using invoke method.

But here comes the problem....
This app is real time...and there is lots of data coming at a very fast
rate....
And when the updation of dataviewex class takes place the cpu takes a
lot of time.....
And in certain cases it even hangs.....takin g almost 100 CPU time...

So my question is that

1) Is it happening because of invoke...Or what is the problem....Why is
the CPU hanigng...
Whats causing the CPU to take such a long time.....

Please any suggestions....

Thanks,
Cheers..

Bye.

The code of the class is below....

using System;
using System.Data;
using System.Componen tModel;

namespace AAA
{
public class DataViewEx : DataView
{
private C1FlexGrid m_fgrdDataGrid;

public DataViewEx(C1Fl exGrid fgrdDataGrid) : base()
{
m_fgrdDataGrid = fgrdDataGrid;
}

private delegate void OnListChangedDe legate(ListChan gedEventArgs e);

protected override void OnListChanged(L istChangedEvent Args e)
{
if ( m_fgrdDataGrid != null && m_fgrdDataGrid. InvokeRequired )
{
m_fgrdDataGrid. Invoke( new OnListChangedDe legate( OnListChanged ),
new object[]{e} );
}
else
base.OnListChan ged(e);
}

private delegate void IndexListChange dDelegate(objec t sender,
ListChangedEven tArgs e);

protected override void IndexListChange d(object sender,
ListChangedEven tArgs e)
{
if ( m_fgrdDataGrid != null && m_fgrdDataGrid. InvokeRequired )
{
m_fgrdDataGrid. Invoke( new IndexListChange dDelegate(
IndexListChange d ), new object[]{ sender, e } );
}
else
base.IndexListC hanged( sender, e );
}
}
}

Jul 6 '06 #2

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

Similar topics

2
4896
by: Hal Vaughan | last post by:
First, I am aware of both SwingUtilities.invokeLater(), and of using Thread to create a new thread.  These are part of the problem. I want to have something running in the background, while the GUI is updating.  I've done that before without a problem, however, now, I need to pass variables to the separate Thread or Runnable that I'm...
2
1783
by: Irvin | last post by:
I new to ASP.net and am using the following code to attempt to update an Access 2000 mdb. The code does make it through the code following "try". NO rows are updated. There is a row with the work_id of 1343. What Am I missing? Your help is appreciated. Irvin Amoraal. <>< ______________________ <%@ Page Language="VB" Debug="true" %> <%@...
5
2015
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated one row, all of them were updated so i immediatelly figured out that i have to include the id of every entry in the update statement. This is where...
7
2568
by: MgGuigg | last post by:
Hello all, This is my first time posting a question to this forum, so here is hoping I am following protocol. I am scraping the rust off my old Basic programming skills, and have just recently upgraded to VB.NET, and I have a lot of catching up to do. That being said, I have come a long way in a short while, however, I am stumped at the...
22
25551
by: Arne | last post by:
How do I pass a dataset to a webservices? I need to submit a shoppingcart from a pocket PC to a webservice. What is the right datatype? II have tried dataset as a datatype, but I can't get it to compile. <WebMethod()> _ Public Function VerifySku(ByVal skus As XmlDataDocument) As DataSet Test program : Dim cartSet As DataSet cartSet =...
7
1035
by: Gary Paris | last post by:
I am pretty new at .NET and am reading a book on ADO.NET but I need some help. I have the following code in the Load routine of a sample program. I would like to read in some data and take the first row and put a few fields on a form. Then I would like to update the data. How on earth can I update the rows when I call an update routine? ...
4
2364
by: Geoff | last post by:
Hi I'm hoping somebody can help me with the following problem that has occurred to me. Suppose I have two tables in an SQL Server database. Let's call these tables A and B. Assume that A has two fields: a primary key and another holding a string. In table B there are three fields: a primary key, a foreign key (which links to the primary...
1
1925
by: FishingScout | last post by:
Thanks for taking a look at this problem for me. I am developing an applicaiton in VB.NET 2005 I have a legacy dll that performs a callback to my windows application. The callback works great and I can update variables and call stored procedures in my database. The callback can represent lots of different activity, one activity is a...
1
1775
by: Neil Chambers | last post by:
This is more likely a question for an SQL group but as I'm using powershell and dotnet it may be relevant Overview: I'm trying to pull data from Excel into a DataSet - modifying the DataSet - then updating the excel source I have got to the point where I think I need Update and Delete Command strings for the DataAdapter but I'm at a loss...
0
7446
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...
0
7718
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. ...
1
7470
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...
0
7809
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...
0
5088
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...
0
3480
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1936
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1058
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
763
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...

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.