Refreshing a ListView

databases Kenya
  • 14 years ago

    I have a ListView control that lists all actors in a db. Should u notice an actor missing, one should click add button, open anew window, add the new actor, and on clicking close window, I need to refresh the original ListView and should see the new entry. How can I do that?

  • 14 years ago

    Hi osemollie

    listview1.refresh

    regards

    DoctorMahdi

  • 14 years ago

    Hi DoctorMahdi

    I think he did'nt mean this

    everyone knows how a listview be refreshed?

    thanks

    VBlover

  • 13 years ago

    Hi Osemollie,

    Once that new actor is added to the database, refresh the total data in the listview and use the following code.

    Here T is the Actor Name you want to find.  LVDetails is the ListView.  (My assumption is actor names are available in the list view first column not in list sub items.  if you are using other columns then use this S = L.ListSubItems(I).Text where "I" is the index of the list sub item.

                Dim L As ListItem, T As String, S as String
                For Each L In LVDetails.ListItems
                    S = L.Text
                    If S = T Then
                        L.Selected = True
                        L.EnsureVisible
                        Exit For
                    End If
                Next L







    I think this will help.

    Ch. V. Sudhakar

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“An expert is a man who has made all the mistakes that can be made in a very narrow field” - Niels Bohr