ListView not populatng
-
I have a main form 'customerForm' with a button which creates a child window 'customerPrintForm' containing a listView. So:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace DebtManagement
{
public partial class DiaryPrintForm : Form
{
private ListViewSortManager m_sortMgr;
private System.Windows.Forms.BindingManagerBase customerBinding;
private Font colorFont;
private int indexCounter = 0;
private customerForm customerForm;
private int customerIndex;public DiaryPrintForm(customerForm customerForm, int customerIndex) { InitializeComponent(); this.customerForm = customerForm; this.customerIndex = customerIndex; customerDataSet.Merge(customerForm.customerDataSet); customerBinding = BindingContext\[customerDataSet, "customer"\]; BindingContext\[customerDataSet, "customer"\].Position = customerIndex; PopulateDiaryListView(); } private void DiaryPrintForm\_Load(object sender, System.EventArgs e) { colorFont = new Font("Wingdings", 12f, GraphicsUnit.Point); } private void DiaryPrintForm\_Closed(object sender, System.EventArgs e) { colorFont = null; } private void PopulateDiaryListView() { DateTime date = new DateTime(1970, 1, 1); string fileToShow = ""; diaryListView.Items.Clear(); if (customerBinding.Count > 0) { foreach (customerDataSet.DiaryRow row in customerDataSet.customer.DefaultView\[customerBinding.Position\].Row.GetChildRows("customerDiary")) { if (row.RowState != DataRowState.Deleted) { customerDataSet.UsersRow user = row.UsersRowByUsersDiary; ListViewItem item = new ListViewItem(); if (row.IsFilenameNull() != true) { item.ImageIndex = 0; } if (row.DiaryActionID.ToString() == "33") { if (row.DiaryDate.CompareTo(date) == 1) {
-
I have a main form 'customerForm' with a button which creates a child window 'customerPrintForm' containing a listView. So:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace DebtManagement
{
public partial class DiaryPrintForm : Form
{
private ListViewSortManager m_sortMgr;
private System.Windows.Forms.BindingManagerBase customerBinding;
private Font colorFont;
private int indexCounter = 0;
private customerForm customerForm;
private int customerIndex;public DiaryPrintForm(customerForm customerForm, int customerIndex) { InitializeComponent(); this.customerForm = customerForm; this.customerIndex = customerIndex; customerDataSet.Merge(customerForm.customerDataSet); customerBinding = BindingContext\[customerDataSet, "customer"\]; BindingContext\[customerDataSet, "customer"\].Position = customerIndex; PopulateDiaryListView(); } private void DiaryPrintForm\_Load(object sender, System.EventArgs e) { colorFont = new Font("Wingdings", 12f, GraphicsUnit.Point); } private void DiaryPrintForm\_Closed(object sender, System.EventArgs e) { colorFont = null; } private void PopulateDiaryListView() { DateTime date = new DateTime(1970, 1, 1); string fileToShow = ""; diaryListView.Items.Clear(); if (customerBinding.Count > 0) { foreach (customerDataSet.DiaryRow row in customerDataSet.customer.DefaultView\[customerBinding.Position\].Row.GetChildRows("customerDiary")) { if (row.RowState != DataRowState.Deleted) { customerDataSet.UsersRow user = row.UsersRowByUsersDiary; ListViewItem item = new ListViewItem(); if (row.IsFilenameNull() != true) { item.ImageIndex = 0; } if (row.DiaryActionID.ToString() == "33") { if (row.DiaryDate.CompareTo(date) == 1) {
look at colorFont :)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
-
look at colorFont :)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
Well, I removed all colorFont references, together with the associated listView column, and this has not improved matters. I still have a 'blank' listView. This is driving me nuts!!:confused:
-
Well, I removed all colorFont references, together with the associated listView column, and this has not improved matters. I still have a 'blank' listView. This is driving me nuts!!:confused:
-
Hmm.. I dont see any : item.Text = "MyTitle"; or something like that. I see only SubItems.
Sorry, but I don't understand your reply. I'm using a) Create new listViewItem b) add subitems to listViewItem c) Add listViewItem to listview model. Which I use successfully elsewhere in my project. I am not sure what your 'item.Text = "MyTitle";' pertains to.
-
Sorry, but I don't understand your reply. I'm using a) Create new listViewItem b) add subitems to listViewItem c) Add listViewItem to listview model. Which I use successfully elsewhere in my project. I am not sure what your 'item.Text = "MyTitle";' pertains to.