Click here to Skip to main content
16,005,121 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# code for windows Pin
dcof5-Sep-11 16:45
dcof5-Sep-11 16:45 
QuestionFacebook friends birthdays? Pin
assafey2-Sep-11 4:34
assafey2-Sep-11 4:34 
AnswerRe: Facebook friends birthdays? Pin
Abhinav S2-Sep-11 7:05
Abhinav S2-Sep-11 7:05 
Questionsave iframe form data to database Pin
vanikanc2-Sep-11 4:04
vanikanc2-Sep-11 4:04 
AnswerRe: save iframe form data to database Pin
Columbus-MCSD2-Sep-11 4:30
Columbus-MCSD2-Sep-11 4:30 
QuestionAddrange Listview Pin
Herboren2-Sep-11 3:28
Herboren2-Sep-11 3:28 
AnswerRe: Addrange Listview Pin
Shameel2-Sep-11 3:51
professionalShameel2-Sep-11 3:51 
AnswerRe: Addrange Listview Pin
Columbus-MCSD2-Sep-11 4:18
Columbus-MCSD2-Sep-11 4:18 
ListView.Items.Add() is horridly slow. So you're onto the right idea when adding a lot of things

This may help you

C#
// build your ArrayList. I give foreach loop as an example, because this is the most common complaint about ListView being slow.

ArrayList al = new ArrayList();
foreach ()
{
    ListViewItem lvi = new ListViewItem();
    lvi.Text = "This is a ListView Item";
    lvi.SubItems.Add("This is for 2nd column text when ListView.View == Details");
    lvi.SubItems.Add("This is for 3rd column text when ListView.View == Details");
    //etc etc with more columns if you want

    al.Add(lvi);
}
Type t = typeof(ListViewItem);

// I haven't tested the performance enhancement, but I believe suspending the layout will speed up things a little more
this._listView.SuspendLayout();
this._listView.Items.AddRange(al.ToArray(t) as ListViewItem[]);
this._listView.ResumeLayout();


That's the general idea behind AddRange(). It speeds things up when adding ListViewItems.

Depending on what you want your output to look like, take the above and modify it to build up some ArrayLists from your string[] fields
AnswerRe: Addrange Listview Pin
BillWoodruff2-Sep-11 6:00
professionalBillWoodruff2-Sep-11 6:00 
QuestionIs it true about decompiling programs written in .net?! Pin
Hamed Hemati2-Sep-11 2:06
Hamed Hemati2-Sep-11 2:06 
AnswerRe: Is it true about decompiling programs written in .net?! Pin
BillWoodruff2-Sep-11 2:24
professionalBillWoodruff2-Sep-11 2:24 
AnswerRe: Is it true about decompiling programs written in .net?! Pin
Dan Mos2-Sep-11 2:24
Dan Mos2-Sep-11 2:24 
GeneralRe: Is it true about decompiling programs written in .net?! Pin
PIEBALDconsult2-Sep-11 3:02
mvePIEBALDconsult2-Sep-11 3:02 
GeneralRe: Is it true about decompiling programs written in .net?! Pin
Hamed Hemati2-Sep-11 3:20
Hamed Hemati2-Sep-11 3:20 
GeneralRe: Is it true about decompiling programs written in .net?! Pin
Columbus-MCSD2-Sep-11 4:22
Columbus-MCSD2-Sep-11 4:22 
GeneralRe: Is it true about decompiling programs written in .net?! Pin
BillWoodruff2-Sep-11 6:02
professionalBillWoodruff2-Sep-11 6:02 
GeneralRe: Is it true about decompiling programs written in .net?! Pin
PIEBALDconsult2-Sep-11 13:56
mvePIEBALDconsult2-Sep-11 13:56 
GeneralRe: Is it true about decompiling programs written in .net?! Pin
harold aptroot2-Sep-11 6:57
harold aptroot2-Sep-11 6:57 
AnswerRe: Is it true about decompiling programs written in .net?! Pin
BobJanova5-Sep-11 0:43
BobJanova5-Sep-11 0:43 
RantI take exception to the way Visual Studio 2010 handles exceptions Pin
Columbus-MCSD2-Sep-11 0:04
Columbus-MCSD2-Sep-11 0:04 
GeneralRe: I take exception to the way Visual Studio 2010 handles exceptions Pin
Rob Philpott2-Sep-11 0:41
Rob Philpott2-Sep-11 0:41 
GeneralRe: I take exception to the way Visual Studio 2010 handles exceptions Pin
Columbus-MCSD2-Sep-11 0:55
Columbus-MCSD2-Sep-11 0:55 
GeneralRe: I take exception to the way Visual Studio 2010 handles exceptions Pin
Shameel2-Sep-11 2:29
professionalShameel2-Sep-11 2:29 
GeneralRe: I take exception to the way Visual Studio 2010 handles exceptions Pin
Columbus-MCSD2-Sep-11 2:51
Columbus-MCSD2-Sep-11 2:51 
GeneralRe: I take exception to the way Visual Studio 2010 handles exceptions Pin
Shameel2-Sep-11 3:10
professionalShameel2-Sep-11 3:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.