I have a listview with 24 rows and 150 columns. I update 3 rows every 10
seconds.
1 2 3 4 ... 150
row1
row2
row3
row4
..
..
..
row24
When this update occurs, I get a processor "spike" of 100% for a total of 7
seconds each update. This "spike" appears to use all of the processor which
is having adverse effects on other threads in the application (losing data,
failed communications, etc..).
I wrote example listviews in Visual C++ 6, Visual Basic 6, and VB .NET. Each
listview performed the same task - update 3 rows every ten seconds.
C++ and VB 6: There was a very small bump in processor usage - around 10% -
12%.
VB .NET: There was a spike of 60% - 70%.
It appears that updating a listview - in VB .NET - can be very expensive.
Has anyone else noticed this problem?
Is there a way to present the data this way without causing the processor
"spike" in VB .NET?
Why is there such a big difference between C++6,VB6, and VB .NET?
Thanks for your help.
K 6 4855
Have you tried turning off the painting until all three rows are
updated?
listviewName.BeginUpdate()
Do your updating here
listviewName.EndUpdate()
Shane
Ken,
Can you tell us how long processing of this code takes.
Just a new project a listview on it and than this in the loadevent
\\\
ListView1.View = View.Details
For i As Integer = 1 To 150
ListView1.Columns.Add(i.ToString, 40, HorizontalAlignment.Left)
Next
Dim start As Integer = Environment.TickCount
ListView1.BeginUpdate()
For j As Integer = 1 To 24
ListView1.Items.Add(j.ToString)
For i As Integer = 1 To 150
ListView1.Items(j - 1).SubItems.Add(i.ToString)
Next
Next
ListView1.EndUpdate()
MessageBox.Show((Environment.TickCount - start).ToString & "Ms")
///
I hope this helps,
Cor
Thanks.
Yes, I tried it and it gives a wicked flicker of the entire list control.
No (good) change in processor usage.
"Shane" <sh********@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com... Have you tried turning off the painting until all three rows are updated?
listviewName.BeginUpdate() Do your updating here listviewName.EndUpdate()
Shane
Thanks. The test I conducted with the code below takes approx 120
milliseconds.
I have added something to the code that makes it more or less a mirror of
what I am doing. It is listed below. It takes much more time. Any major
problems with it that you can see?
Added a timer and set the interval to 10000 ms.
Inside the timer method:
Dim start As Integer = Environment.TickCount ListView1.BeginUpdate() For j As Integer = 1 To 24 For i As Integer = 1 To 150 ListView1.Items(j - 1).SubItems(i).Text = i.ToString Next Next ListView1.EndUpdate() MessageBox.Show((Environment.TickCount - start).ToString & "Ms")
I also changed your code snippet to add all 0's upon startup. This is how my
app currently functions.
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl... Ken,
Can you tell us how long processing of this code takes.
Just a new project a listview on it and than this in the loadevent
\\\ ListView1.View = View.Details For i As Integer = 1 To 150 ListView1.Columns.Add(i.ToString, 40, HorizontalAlignment.Left) Next Dim start As Integer = Environment.TickCount ListView1.BeginUpdate() For j As Integer = 1 To 24 ListView1.Items.Add(j.ToString) For i As Integer = 1 To 150 ListView1.Items(j - 1).SubItems.Add(i.ToString) Next Next ListView1.EndUpdate() MessageBox.Show((Environment.TickCount - start).ToString & "Ms") ///
I hope this helps,
Cor
I have been testing your scenario some more. I have come up with a 70-80
millisecond time when loading. Just a FYI. 120 to 80 Ms is a big difference.
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl... Ken,
Can you tell us how long processing of this code takes.
Just a new project a listview on it and than this in the loadevent
\\\ ListView1.View = View.Details For i As Integer = 1 To 150 ListView1.Columns.Add(i.ToString, 40, HorizontalAlignment.Left) Next Dim start As Integer = Environment.TickCount ListView1.BeginUpdate() For j As Integer = 1 To 24 ListView1.Items.Add(j.ToString) For i As Integer = 1 To 150 ListView1.Items(j - 1).SubItems.Add(i.ToString) Next Next ListView1.EndUpdate() MessageBox.Show((Environment.TickCount - start).ToString & "Ms") ///
I hope this helps,
Cor
Just curious,
Are you doing this as a client app or as a web app with a server side
control?
"Ken" <ks***@s32443t.com> wrote in message
news:uD****************@TK2MSFTNGP10.phx.gbl... I have a listview with 24 rows and 150 columns. I update 3 rows every 10 seconds.
1 2 3 4 ... 150 row1 row2 row3 row4 . . . row24
When this update occurs, I get a processor "spike" of 100% for a total of
7 seconds each update. This "spike" appears to use all of the processor
which is having adverse effects on other threads in the application (losing
data, failed communications, etc..).
I wrote example listviews in Visual C++ 6, Visual Basic 6, and VB .NET.
Each listview performed the same task - update 3 rows every ten seconds.
C++ and VB 6: There was a very small bump in processor usage - around
10% - 12%. VB .NET: There was a spike of 60% - 70%.
It appears that updating a listview - in VB .NET - can be very expensive.
Has anyone else noticed this problem? Is there a way to present the data this way without causing the processor "spike" in VB .NET? Why is there such a big difference between C++6,VB6, and VB .NET?
Thanks for your help.
K This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Anushya |
last post by:
Hi
I am using Listview and inherited listview control overriding WndProc
& PreProcessMessage in ListView.
I need this to customize listview to display only the page the user
scrolls to. Since i...
|
by: Anushya |
last post by:
Hi
I am using Listview and inherited listview control overriding WndProc
& PreProcessMessage in ListView.
I need this to customize listview to display only the page the user
scrolls to. Since i...
|
by: keith |
last post by:
In a ListView control (two columns), I added a few
ListView items.
ListView listview=new ListView();
listview.Parent=this;
listview.View=View.Details;
listview.Columns.Add...
|
by: Dave Y |
last post by:
I am a newbie to C# and am having trouble trying to override a ListView
property method. I have created a new class derived from the Forms.Listview
and I cannot figure out the syntax to override...
|
by: BobAchgill |
last post by:
I am trying to decide which of these controls to use to
implement letting my user select a full row from
MyList. The MyList has several columns which would be
nice to sort by at run time. The...
|
by: John Devlon |
last post by:
Hi,
Does anyone know how to get a value of a second column of a selected item
in Listview.
I've create a listview and added this code
Listview.Items.Clear()
Listview.Columns.Clear()...
|
by: Peter |
last post by:
Hi,
I have a problem with Listview using checkboxes.
If i check items by code BEFORE the form is shown the Listview.Items
are confused during the ItemChecked Event !!!
After showing the...
|
by: Peter |
last post by:
Hi,
I have a problem with Listview using checkboxes.
If i check items by code BEFORE the form is shown the Listview.Items
are confused during the ItemChecked Event !!!
After showing the...
|
by: Brian Gaze |
last post by:
I have created a ListView control and have bound this to a datasource.
Within the ItemTemplate of the ListView I have added another ListViewControl
which is databound in the code behind. The idea...
|
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= |
last post by:
Hello,
In my application I need to periodically remove all current items from a
ListView and add a new set into it. The following abbreviated code contains
the basic idea:
private void...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
| |