listview does not display contents

G

Guest

After the following subroutine executes, my listview shows a scroll bar on the right, but it is otherwise blank. I've checked for things like locked=false, visable=true, font color same as background, but I don't see anything that should be hiding the contents. I've inserted various msgbox lines to display listview1.Items.Count, and these show that the listview does have data in it. I'm lost

The code (it's not very long)

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Clic
Dim dt As DataTabl
Dim dc As DataColum
Dim dr As DataRo
Dim lvi As ListViewIte
Dim lvsi As ListViewItem.ListViewSubIte
Dim idx As Intege

Me.OracleDataAdapter1.Fill(Me.DataSet11

dt = Me.DataSet11.Tables(0
Me.Label1.Text = dt.Rows.Count & " items found.

Me.ListView1.View = View.Detail

For Each dc In dt.Columns ' load column header
ListView1.Columns.Add(dc.ColumnName, -1, HorizontalAlignment.Left
' MsgBox(dc.ColumnName
Nex

For Each dr In dt.Rows ' load dat
lvi = New ListViewIte
If IsDBNull(dr.ItemArray(0)) Then ' load primary ite
lvi.Text = "
Els
lvi.Text = dr.ItemArray(0
End I
For idx = 1 To dt.Columns.Count - 1 ' load subitem
If IsDBNull(dr.ItemArray(idx)) The
lvi.SubItems.Add(""
Els
lvi.SubItems.Add(dr.ItemArray(idx).ToString()
End I
Nex
ListView1.Items.Add(lvi
Nex

MsgBox("end"
End Su
 
C

Cor

Hi Rallard,

Nice routine,

I think there is only a very little thing in it.
ListView1.Columns.Add(dc.ColumnName, -1,
HorizontalAlignment.Left)

The width -1 is not what it has to be I think, can you try to set it on
another value?

I hope this is the errror?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top