Results 1 to 6 of 6

Thread: [RESOLVED] Listview acting not normal.

  1. #1

    Thread Starter
    Frenzied Member Pc_Not_Mac's Avatar
    Join Date
    Oct 2009
    Location
    localhost
    Posts
    1,206

    Resolved [RESOLVED] Listview acting not normal.

    Hello, I'm trying to add items to the listview, but ever time i add a icon the Listview freezes\blinks a white color for a millisecond.
    A millisecond is not a lot, but when you add 5 items per second to the listview then all you see is a white shade blinking.
    I tried slowing the thread down so it takes longer for it add the items still no luck.

    Did it ever happen to you?
    If so how did you resolve it?

    Any suggestion will help.
    Last edited by Pc_Not_Mac; Nov 29th, 2010 at 07:48 PM.
    My Codebank:
    Windows Vista & 7 Glass Effect & Limit the amount of times your application could be opened.
    Pause Your Code & Check the OS name

    The question of whether computers can think is like the question of whether submarines can swim.

    Currently learning: Java

    Coding can be a learning experience or

  2. #2
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Re: Listview acting not normal.

    As always, it's situational. We can't tell you what you're doing wrong until we know how you're doing it.

    I have a bunch of applications that I add icons to a ListView and never have a flashing problem.
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  3. #3
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: Listview acting not normal.

    try adding your items to a list(of listviewitem) then adding the list in 1 go:

    vb Code:
    1. listview1.items.addrange(list.toarray)

  4. #4

    Thread Starter
    Frenzied Member Pc_Not_Mac's Avatar
    Join Date
    Oct 2009
    Location
    localhost
    Posts
    1,206

    Re: Listview acting not normal.

    This is how i add my items.

    Code:
    Dim str As String = "TEST"
            Dim itm As ListViewItem
            itm = New ListViewItem(str)
            itm.ImageIndex = 1
            ListView1.Items.Add(itm)
    Paul do mean that i have to replace the
    ListView1.Items.Add(itm)
    with
    listview1.items.addrange(list.toarray)
    Or no?
    My Codebank:
    Windows Vista & 7 Glass Effect & Limit the amount of times your application could be opened.
    Pause Your Code & Check the OS name

    The question of whether computers can think is like the question of whether submarines can swim.

    Currently learning: Java

    Coding can be a learning experience or

  5. #5
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: Listview acting not normal.

    vb Code:
    1. dim items as new list(of listviewitem)
    2.  
    3. for x as integer = 1 to 100
    4.     Dim str As String = "TEST" & x.tostring
    5.     Dim itm As ListViewItem
    6.     itm = New ListViewItem(str)
    7.     itm.ImageIndex = 1
    8.     items.add(itm)
    9. next
    10.  
    11. ListView1.Items.Addrange(items.toarray)

  6. #6

    Thread Starter
    Frenzied Member Pc_Not_Mac's Avatar
    Join Date
    Oct 2009
    Location
    localhost
    Posts
    1,206

    Re: Listview acting not normal.

    Wow thank you Paul.
    It works!
    I have added rep
    My Codebank:
    Windows Vista & 7 Glass Effect & Limit the amount of times your application could be opened.
    Pause Your Code & Check the OS name

    The question of whether computers can think is like the question of whether submarines can swim.

    Currently learning: Java

    Coding can be a learning experience or

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width