HLP: Adding Column Info to ListView

M

Mr. B

What I'm trying to do is to Add the information of Two Tables into a single
ListView. The ListView has 10 columns.

The following Code populates the LV columns 1 to 5 (or rather 0 to 4) from a
DataSet...

Private Sub MstrEmPay()

Dim dtDataTbl As DataTable = DsMstrEmPay.MASTER_PRM_EMPLOYEE_PAY

' Get Info from Data Base
For cntr = 0 To DsMstrEmPay.MASTER_PRM_EMPLOYEE_PAY.Rows.Count - 1
Dim dr As DataRow = dtDataTbl.Rows(cntr)

Dim LItem As New ListViewItem
Dim rowTtl As Double = 0
LItem = New ListViewItem
LItem.Text = dr("amount")
LItem.SubItems.Add(dr("employee"))
LItem.SubItems.Add(dr("pay_id"))
LItem.SubItems.Add(dr("pay_type"))
lvProjDisplay.Items.Add(LItem)
Next ' cntr

End Sub


What I want to do is to get the info of another DataSet and dump it's info
into the next 5 remaining Columns (starting at the first row of the
ListView).

I've done some reading and I 'think' I need something like:

LItem.SubItems.Insert(5, myTextHere)... but haven't found how to make this
work.

Anyone can help?

Regards,

Bruce
 
B

Björn Holmgren

Mr. B said:
What I'm trying to do is to Add the information of Two Tables into a single
ListView. The ListView has 10 columns.

The following Code populates the LV columns 1 to 5 (or rather 0 to 4) from a
DataSet...

Private Sub MstrEmPay()

Dim dtDataTbl As DataTable = DsMstrEmPay.MASTER_PRM_EMPLOYEE_PAY

' Get Info from Data Base
For cntr = 0 To DsMstrEmPay.MASTER_PRM_EMPLOYEE_PAY.Rows.Count - 1
Dim dr As DataRow = dtDataTbl.Rows(cntr)

Dim LItem As New ListViewItem
Dim rowTtl As Double = 0
LItem = New ListViewItem
LItem.Text = dr("amount")
LItem.SubItems.Add(dr("employee"))
LItem.SubItems.Add(dr("pay_id"))
LItem.SubItems.Add(dr("pay_type"))
lvProjDisplay.Items.Add(LItem)
Next ' cntr

End Sub


What I want to do is to get the info of another DataSet and dump it's info
into the next 5 remaining Columns (starting at the first row of the
ListView).

I've done some reading and I 'think' I need something like:

LItem.SubItems.Insert(5, myTextHere)... but haven't found how to make this
work.

Anyone can help?


What kind of listview is that? The ListView from "Microsoft Windows Common
Controls" version 5 and 6 doesn't have an Items collection (it's called
ListItems).
 
B

Björn Holmgren

Björn Holmgren said:
What kind of listview is that? The ListView from "Microsoft Windows Common
Controls" version 5 and 6 doesn't have an Items collection (it's called
ListItems).


Wait a minute! Is that VB.NET? (I'm reading this from vb.database.ado)
 
M

Mr. B

Björn Holmgren said:
What kind of listview is that? The ListView from "Microsoft Windows Common
Controls" version 5 and 6 doesn't have an Items collection (it's called
ListItems).

Sorry... VB.net!

Bruce
 

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