473,654 Members | 3,062 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Inserting rows between existing rows in a list view and List view Flicker

Hello.

Is there a way you can insert a new row between current rows in a .NET
listview? I tried and it was no success. The reason I want to do
this is because when the application starts up it prints a list of
id's in the listview window. The window has to be updated every
2seconds and I would need to be able to insert the data pertaining to
a certain id under that id.

So far, I havent found a way to acheive this so I'm currently updating
the entire window and reprinting everything. Unfortunately, this
doesnt allow the user to click on the id and expand the rows and show
the information under the id or to hide the information under the id,
because the id is constantly being updated.

Also, is there a way to stop the flicker in a listview when it is
being updated?

Does anyone have any suggestions?

Thanks.

Apr 4 '07 #1
4 3817
<Mi**********@g mail.comwrote in message
news:11******** **************@ e65g2000hsc.goo glegroups.com.. .
Is there a way you can insert a new row between current rows in a .NET
listview? I tried and it was no success. The reason I want to do
this is because when the application starts up it prints a list of
id's in the listview window. The window has to be updated every
2seconds and I would need to be able to insert the data pertaining to
a certain id under that id.
I should point out that I'm not at expert at .Net.

That said, in Win32 what you do in a case like yours is to send the listview
control a WM_SETREDRAW message inhibiting repaints, then you make the
changes, then you invalidate the control and finally you send another
WM_SETREDRAW to re-enanle display updates.

A quick google seems to imply that others who have wanted to do this have
P/Invoked the native technique that I sketched:

http://weblogs.asp.net/jdanforth/arc.../12/88458.aspx

http://www.windowsforms.net/FAQs/def...=22&tabindex=3

Regards,
Will
www.ivrforbeginners.com
Apr 4 '07 #2

"William DePalo [MVP VC++]" <wi***********@ mvps.orgwrote in message
news:uM******** ********@TK2MSF TNGP02.phx.gbl. ..
<Mi**********@g mail.comwrote in message
news:11******** **************@ e65g2000hsc.goo glegroups.com.. .
>Is there a way you can insert a new row between current rows in a .NET
listview? I tried and it was no success. The reason I want to do
this is because when the application starts up it prints a list of
id's in the listview window. The window has to be updated every
2seconds and I would need to be able to insert the data pertaining to
a certain id under that id.
ListView has an Items property, which in turn exposes an Insert method. Is
that what you've tried? Are you using data binding? In that case,
implement IBindingList and fire the ListChanged event passing ItemAdded in
the ListChangedEven tArgs.
>
I should point out that I'm not at expert at .Net.

That said, in Win32 what you do in a case like yours is to send the
listview control a WM_SETREDRAW message inhibiting repaints, then you make
the changes, then you invalidate the control and finally you send another
WM_SETREDRAW to re-enanle display updates.

A quick google seems to imply that others who have wanted to do this have
P/Invoked the native technique that I sketched:

http://weblogs.asp.net/jdanforth/arc.../12/88458.aspx

http://www.windowsforms.net/FAQs/def...=22&tabindex=3
The .NET way is SuspendLayout/ResumeLayout, which may or may not be 100%
effective for ListView
Regards,
Will
www.ivrforbeginners.com


Apr 5 '07 #3
On Apr 5, 4:36 pm, "Ben Voigt" <r...@nospam.no spamwrote:
"William DePalo [MVP VC++]" <willd.no.s...@ mvps.orgwrote in messagenews:uM* *************** @TK2MSFTNGP02.p hx.gbl...
<Miesha.Ja...@g mail.comwrote in message
news:11******** **************@ e65g2000hsc.goo glegroups.com.. .
Is there a way you can insert a new row between current rows in a .NET
listview? I tried and it was no success. The reason I want to do
this is because when the application starts up it prints alistof
id's in the listview window. The window has to be updated every
2seconds and I would need to be able to insert the data pertaining to
a certain id under that id.

ListView has an Items property, which in turn exposes an Insert method. Is
that what you've tried? Are you using data binding? In that case,
implement IBindingList and fire the ListChanged event passing ItemAdded in
the ListChangedEven tArgs.
I should point out that I'm not at expert at .Net.
That said, in Win32 what you do in a case like yours is to send the
listview control a WM_SETREDRAW message inhibiting repaints, then you make
the changes, then you invalidate the control and finally you send another
WM_SETREDRAW to re-enanle display updates.
A quick google seems to imply that others who have wanted to do this have
P/Invoked the native technique that I sketched:
http://weblogs.asp.net/jdanforth/arc.../12/88458.aspx
http://www.windowsforms.net/FAQs/def...ItemID=193&Cat...

The .NETway is SuspendLayout/ResumeLayout, which may or may not be 100%
effective for ListView
Regards,
Will
www.ivrforbeginners.com- Hide quoted text -

- Show quoted text -
I tried to get the index of the row I need to place the new row under
and I tried to insert the row by adding 1 to the index, but I got an
error saying that it already existed. I'm currently clearing all of
the items out of the list and rewriting them, but I think it adds to
the flicker problem and I can't add an event handler to the id column,
because it's constantly being cleared and rewritten. I will look into
the data binding.

Will, thanks for the P/Invoke idea. I haven't implemented it yet, but
I'm currently working on it.

Thanks.

Apr 6 '07 #4
I tried to get the index of the row I need to place the new row under
and I tried to insert the row by adding 1 to the index, but I got an
error saying that it already existed. I'm currently clearing all of
the items out of the list and rewriting them, but I think it adds to
the flicker problem and I can't add an event handler to the id column,
because it's constantly being cleared and rewritten. I will look into
the data binding.
Uh-uh. Don't look into databinding. I was just saying, that IF you were
using databinding, would explain why you couldn't insert a row with the
normal method (Insert).

What line of code gave you an error that the row already existed? Please
indicate the data type of each variable that appears in that line as well.
>
Will, thanks for the P/Invoke idea. I haven't implemented it yet, but
I'm currently working on it.

Thanks.

Apr 9 '07 #5

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

Similar topics

0
2424
by: Marko Poutiainen | last post by:
Situation: We had to make our SQLServer 2000 database multi-lingual. That is, certain things (such as product names) in the database should be shown in the language the user is using (Finnish, Swedish or English). There are about a dozen tables with columns that need localization. Doing this in the application level was a no-goer. It would have taken far too much time (there is a *lot* of code and unfortunately most of the...
4
2011
by: Little PussyCat | last post by:
Hello, I have had a request, one of our tables is used as a report and I have been asked that all fieldnames for months have dashes in them, like Jan-05 instead of Jan05 and so on... Now what we have is a CURSOR which loops through all values in another table generating these fieldnames, like 'Jan-05', Feb-05' etc.. Then the table definition is modified so these months display as fieldnames.
3
6895
by: Joachim Klassen | last post by:
Hi all, first apologies if this question looks the same as another one I recently posted - its a different thing but for the same szenario:-). We are having performance problems when inserting/deleting rows from a large table. My scenario: Table (lets call it FACT1) with 1000 million rows distributed on 12
13
7774
by: Dixie | last post by:
How do I, in VBA from an access form module, add 5 rows to the top of a spreadsheet called MySpreadsheet.xls. The worksheet is called MyWorksheet and there is already data in the first 5 rows. I simply need to insert 5 blank rows at the top and move the rest of the data down so it starts at row 6. dixie
2
4020
by: a | last post by:
NEW Post Here's my best guess at how to insert this dataset.... the code runs, but no new records are added to the sql table. I've read and split a delimited text file into a dataset. It looks fine in a datagrid (5 columns and 5,000 rows), but I've been trying, without success, to then insert the resulting dataset called "result" into a single sql table that has an auto-increment and PK column called ID,
11
2074
by: Mellow Crow | last post by:
I had a problem in IE 6 when trying to insert a table using W3C DOM techniques. I found a solution and share it. :) Initially I had...... ********************** <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
6
3137
by: Mike Wilson | last post by:
Dear Group, I have a heirarchical set of database tables, say - "order" and "order_type" and want to display a series of orders in a grid control, and in place of the order_type foreign key identifier, I would like a dropdown combo box (lookup from the "order_type" table) to change the type of the order. I also need an update command button, a delete row button and also an insert new row button. I'm sure this is a very common design...
3
4268
by: rcoco | last post by:
Hi, I want to share this problem. I have a datagrid that will help me Insert data into sql database. So I made a button On my form so that when I press the button a new row on datagrid should be created and I could be able to insert data. But with this code below I've failed could someone help me and tell me where I'm going wrong: private void Page_Load(object sender, System.EventArgs e) { if (! IsPostBack)
3
2734
by: BNW | last post by:
Hi I'm trying to find a way in inserting a new row between an existing row in an Access Table just like an Excell Spreadsheet. The reason I need to know is because I have information in a table that needs to grouped together an already generated report such as all Activitity Information. What I have to do is to order each category in the table by inserting a number manually in the Order Column in order for the information to be grouped...
0
8375
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
8290
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
8707
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
6161
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
5622
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
4149
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
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2714
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
1916
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.