473,668 Members | 2,755 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Listview

Ken
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


Nov 21 '05 #1
6 4900
Have you tried turning off the painting until all three rows are
updated?

listviewName.Be ginUpdate()
Do your updating here
listviewName.En dUpdate()

Shane

Nov 21 '05 #2
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.Colum ns.Add(i.ToStri ng, 40, HorizontalAlign ment.Left)
Next
Dim start As Integer = Environment.Tic kCount
ListView1.Begin Update()
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.EndUp date()
MessageBox.Show ((Environment.T ickCount - start).ToString & "Ms")
///

I hope this helps,

Cor
Nov 21 '05 #3
Ken
Thanks.

Yes, I tried it and it gives a wicked flicker of the entire list control.
No (good) change in processor usage.

"Shane" <sh********@yah oo.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
Have you tried turning off the painting until all three rows are
updated?

listviewName.Be ginUpdate()
Do your updating here
listviewName.En dUpdate()

Shane

Nov 21 '05 #4
Ken
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.Tic kCount
ListView1.Begin Update()
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.EndUp date()
MessageBox.Show ((Environment.T ickCount - 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******** **********@TK2M SFTNGP09.phx.gb l... 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.Colum ns.Add(i.ToStri ng, 40, HorizontalAlign ment.Left)
Next
Dim start As Integer = Environment.Tic kCount
ListView1.Begin Update()
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.EndUp date()
MessageBox.Show ((Environment.T ickCount - start).ToString & "Ms")
///

I hope this helps,

Cor

Nov 21 '05 #5
Ken
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******** **********@TK2M SFTNGP09.phx.gb l...
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.Colum ns.Add(i.ToStri ng, 40, HorizontalAlign ment.Left)
Next
Dim start As Integer = Environment.Tic kCount
ListView1.Begin Update()
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.EndUp date()
MessageBox.Show ((Environment.T ickCount - start).ToString & "Ms")
///

I hope this helps,

Cor

Nov 21 '05 #6
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******** ********@TK2MSF TNGP10.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

Nov 21 '05 #7

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

Similar topics

6
2621
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 am populating listview with more than 200,000 items. It is too slow and tried virtual listview. But that doesnot allow me to add images in the listview. So now trying to list only the page user scrolls to.
0
489
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 am populating listview with more than 200,000 items. It is too slow and tried virtual listview. But that doesnot allow me to add images in the listview. So now trying to list only the page user scrolls to.
0
2222
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 ("Col1",200,HorizontalAlignment.Left); listview.Columns.Add ("Col2",800,HorizontalAlignment.Left);
7
6436
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 ListView.Items.Add(), . I see that it is a virtual method so it should be easy to do. If anyone can help I would appreciate it greatly. I can do what I need to do in a different way this would just make everything significantly cleaner and eaasier...
7
14984
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 MyList data is resident in a dataset table. I'm stuck and can't choose either because. If I choose ListView as my control I don't understand how to programmatically get the data from the dataset table
5
25944
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() Listview.View = View.Details
0
1886
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 form every thing works fine: checking items by code as well as checking with mouse: Using the CheckdItems Property is confused too.
2
6826
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 form every thing works fine: checking items by code
4
4504
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 is that when clicking on the "Show details" button the ListView for the appropriate row binds in the codebehind and displays the detail data for the selected row. I did something similar with a gridview control previously, but want to be able to...
1
8347
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 FillListViewFromFile(string path) {
0
8462
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8381
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
8893
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
8656
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
7401
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6209
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4205
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4380
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2023
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.