|
-
Mar 31st, 2007, 09:37 AM
#1
Thread Starter
Addicted Member
[RESOLVED] loading listview
This is so frustrating, I must be missing something too simple. But I have been on this for hours and cannot load a simple listview... I have just migrated to .Net so it is a little different... THis is what I have and nothing is showing, not even the column headers..... I know there is data there...
Please help.. Thanks so much
ST_ind = pFeature.Fields.FindField(ST_ID)
Offset_ind = pFeature.Fields.FindField(OFFSET)
lsvStations.View = View.Details
lsvStations.Columns.Add("Station ID", 100, HorizontalAlignment.Left)
lsvStations.Columns.Add("Offset", 200, HorizontalAlignment.Left)
lsvStations.Clear()
Do While Not (pFeature Is Nothing)
Dim SSItem1 As New ListViewItem(pFeature.Value(ST_ind).ToString())
SSItem1.SubItems.Add(pFeature.Value(ST_ind).ToString())
SSItem1.SubItems.Add(pFeature.Value(Offset_ind).ToString())
lsvStations.Items.AddRange(New ListViewItem() {SSItem1})
pFeature = pFCursor.NextFeature
Loop
-
Mar 31st, 2007, 09:50 AM
#2
Hyperactive Member
Re: loading listview
Well to get your column headers to show you need to set the view mode to details.
vb Code:
ListView1.View = View.Details
Have you set a breakpoint at the start of the loop to see if it actually steps into the loop or just jumps past it ?
EDIT: just noticed in your code that you've done the details property.
When you call 'clear()' you are removing the column headers, this is why no headers are showing.
Call the items.clear() method instead this will clear the items but leave the headers alone...
Last edited by Tinbeard; Mar 31st, 2007 at 09:55 AM.
If my post helps , please feel free to rate it 
-
Mar 31st, 2007, 09:56 AM
#3
Re: loading listview
Yeah Tinbeard is right, calling ListView.Clear() removes the items AND columns. Youd want to use ListView1.Items.Clear()
-
Apr 1st, 2007, 12:10 PM
#4
Thread Starter
Addicted Member
Re: loading listview
Thanks, that did it.. I guess the clear was in the wrong place, that was all I had to change..
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|