Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

listview just displaying four items

Posted on 2013-06-03
5
Medium Priority
?
377 Views
Last Modified: 2013-06-04
Hi,

I have a listview which should be displaying all the records from the database.  But it keeps displaying only 4 records that too recently added. it ignores all the previous items.  Any idea how to resolve this?

HEre is the code for it.
  Try
         
            If d.ditems.Count > 0 Then


             
                Dim foo As String
                Dim foo1() As String
                Dim item As ListViewItem
                lvfoo.Items.Clear()
                'For Each foo In d.ditems
         
                    foo1 = foo.Split("|")
                    item = New ListViewItem(foo(0))
                    Me..Items.Add(item)
                    item.SubItems.Add(foo(1))
                    item.SubItems.Addfoo(2))

                    'item = Nothing
                Next
            End If
        Catch ex As Exception
            SystemException(ex.ToString)
        End Try

Open in new window

0
Comment
Question by:developer2012
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 8

Expert Comment

by:PagodNaUtak
ID: 39218122
Hi,

Can you check the value of d.ditems.Count? How do you populate the items in d.ditems.count?
0
 

Author Comment

by:developer2012
ID: 39218136
I am populating the values from database.
0
 
LVL 42

Accepted Solution

by:
sedgwick earned 1000 total points
ID: 39218204
the ode u posted is not compiled and also has a logic error in it.
i assume d.ditems contains the data from database?
did u debug the code and check how many records are they?
u can using linq, to add the records to the listview without iterating the items:
  Try
         
            If d.ditems.Count > 0 Then

                lvfoo.Items.Clear()
        Dim items As ListViewItem() = d.ditems.Select(Function(item) New ListViewItem(item.Split("|").ToArray))
        lvfoo.Items.AddRange(items)
            End If
        Catch ex As Exception
            SystemException(ex.ToString)
        End Try

Open in new window

0
 
LVL 8

Expert Comment

by:PagodNaUtak
ID: 39218366
Can you show us the code on how you populate the d.ditems?
0
 

Author Comment

by:developer2012
ID: 39219077
Fixed.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question