CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2011
    Posts
    3

    [Help] Listview won't refresh

    Hey, I could use some help.
    I have two windows forms. On the second form I select an item that is added to a list of items in a database, this works perfectly. After it has been added I close the second form and I want the listview on the first form to be refreshed. But the listview turns up completly blank, not even the columnheaders appear. I know the function fillListView() works as well because I've used it elsewhere.

    This is my code, I think there is something I'm missing here:

    Try
    Dim oForm As New AddToList(moList)
    oForm.ShowDialog()

    lvwDetailsList.Clear()
    fillListView()
    Catch ex As Exception

    MessageBox.Show(ex.Message)
    End Try

    'End code

    Some help would be great.

  2. #2
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,675

    Arrow Re: [Help] Listview won't refresh

    Your code looks suspiciously like VB .NET to me, so you'd probably have a better chance to get answers in the appropriate forum. The one here is for VB6.

    Please use code tags when posting code.

    Ah, and... Welcome to CodeGuru, anyway!
    Last edited by Eri523; January 6th, 2011 at 10:26 AM.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  3. #3
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: [Help] Listview won't refresh

    lvwDetailsList.Clear()
    fillListView()
    I think you want to clear the items from the list rather than the list. Most likey this first line is the problem as it will remove the columns and headers as well as any data in the list and afterwards additem methods with not show any data on screen.

    I take it you have a sub routine to fill the list but you did not include that so this is all I can tell you.
    Always use [code][/code] tags when posting code.

  4. #4
    Join Date
    Jan 2011
    Posts
    3

    Re: [Help] Listview won't refresh

    Thanks DataMiser, that fixed it. It was kind of silly that I didn't notice that.

    thanks again!

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

Featured