Click here to Skip to main content
15,916,030 members
Home / Discussions / C#
   

C#

 
AnswerRe: Array in class Pin
stancrm17-Aug-09 2:59
stancrm17-Aug-09 2:59 
GeneralRe: Array in class Pin
gamer112717-Aug-09 3:06
gamer112717-Aug-09 3:06 
GeneralRe: Array in class Pin
stancrm17-Aug-09 3:08
stancrm17-Aug-09 3:08 
QuestionHow to add a toolbar in a window using c# Pin
svt gdwl17-Aug-09 2:46
svt gdwl17-Aug-09 2:46 
AnswerRe: How to add a toolbar in a window using c# Pin
stancrm17-Aug-09 2:51
stancrm17-Aug-09 2:51 
AnswerRe: How to add a toolbar in a window using c# Pin
mustang8617-Aug-09 6:29
mustang8617-Aug-09 6:29 
QuestionCalc expression from string at runtime Pin
bonzaiholding17-Aug-09 2:44
bonzaiholding17-Aug-09 2:44 
AnswerRe: Calc expression from string at runtime Pin
stancrm17-Aug-09 3:06
stancrm17-Aug-09 3:06 
AnswerRe: Calc expression from string at runtime Pin
Eddy Vluggen17-Aug-09 3:07
professionalEddy Vluggen17-Aug-09 3:07 
GeneralRe: Calc expression from string at runtime Pin
bonzaiholding17-Aug-09 4:22
bonzaiholding17-Aug-09 4:22 
GeneralRe: Calc expression from string at runtime Pin
Eddy Vluggen17-Aug-09 4:43
professionalEddy Vluggen17-Aug-09 4:43 
AnswerRe: Calc expression from string at runtime Pin
PIEBALDconsult17-Aug-09 6:03
mvePIEBALDconsult17-Aug-09 6:03 
Question[Message Deleted] Pin
saber ahmadi17-Aug-09 1:35
saber ahmadi17-Aug-09 1:35 
AnswerRe: Custom Setup for c# app Pin
Eddy Vluggen17-Aug-09 3:41
professionalEddy Vluggen17-Aug-09 3:41 
GeneralRe: Custom Setup for c# app Pin
saber ahmadi18-Aug-09 0:22
saber ahmadi18-Aug-09 0:22 
QuestionYour current security settings prohibit running ActiveX controls on this page. As a result, the page may not display correctly Pin
Affan Saied17-Aug-09 1:13
Affan Saied17-Aug-09 1:13 
QuestionIEqualityComparer Pin
vidhyaravichandar17-Aug-09 1:00
vidhyaravichandar17-Aug-09 1:00 
AnswerCross post: Being answered in .NET Framework section Pin
Pete O'Hanlon17-Aug-09 3:45
mvePete O'Hanlon17-Aug-09 3:45 
GeneralRe: Cross post: Being answered in .NET Framework section Pin
vidhyaravichandar17-Aug-09 15:23
vidhyaravichandar17-Aug-09 15:23 
QuestionHow to Change the datagridview cell value color Pin
Nitin K17-Aug-09 0:08
Nitin K17-Aug-09 0:08 
AnswerRe: How to Change the datagridview cell value color Pin
Coding C#17-Aug-09 0:27
Coding C#17-Aug-09 0:27 
GeneralRe: How to Change the datagridview cell value color Pin
Henry Minute17-Aug-09 0:50
Henry Minute17-Aug-09 0:50 
GeneralRe: How to Change the datagridview cell value color Pin
Nitin K17-Aug-09 1:23
Nitin K17-Aug-09 1:23 
GeneralRe: How to Change the datagridview cell value color Pin
Henry Minute17-Aug-09 1:31
Henry Minute17-Aug-09 1:31 
QuestionListView not populatng Pin
kanchoette16-Aug-09 23:33
kanchoette16-Aug-09 23:33 
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)
                            {
                                date = row.DiaryDate;
                                if (row["Filename"] != DBNull.Value)
                                {
                                    fileToShow = row.Filename.ToString();
                                }
                            }

                        }

                        item.SubItems.Add('\x6E'.ToString(), Color.FromArgb(row.DiaryActionRow.Color), diaryListView.BackColor, colorFont);
                        item.SubItems.Add(row.ManagerPriority.ToString());
                        item.SubItems.Add(row.UserPriority.ToString());
                        item.SubItems.Add(row.DiaryDate.ToString());
                        item.SubItems.Add(row.DiaryActionRow.Description);
                        item.SubItems.Add(row.Description);
                        item.SubItems.Add(row.IsDueDateNull() ? "" : row.DueDate.ToString());
                        item.SubItems.Add(row.Complete ? "Yes" : "No");
                        item.SubItems.Add(row.Charges.ToString("C"));
                        item.SubItems.Add(user.IsInitialsNull() ? "" : user.Initials);
                        item.SubItems.Add(row.IsNotesNull() ? "" : row.Notes);
                        item.SubItems.Add(row.ActionedByID.ToString());
                        item.SubItems.Add(row.Acknowledged.ToString());
                        item.SubItems.Add(row.IsLetterIDNull() ? "" : row.LetterID.ToString());
                        item.SubItems.Add(row.IsFilenameNull() ? "" : row.Filename.ToString());
                        item.SubItems.Add(user.IsFullNameNull() ? "" : user.FullName.ToString());

                        item.Tag = row;
                        diaryListView.Items.Add(item);
                        indexCounter++;
                    }

                    m_sortMgr = new ListViewSortManager(diaryListView,
                new Type[] {   
                               typeof(ListViewTextSort), 
                               typeof(ListViewTextSort), 
                               typeof(ListViewTextSort), 
                               typeof(ListViewTextSort), 
                               typeof(ListViewDateSort),
                               typeof(ListViewTextSort), 
                               typeof(ListViewTextSort),
                               typeof(ListViewDateSort),
                               typeof(ListViewTextSort),
                               typeof(ListViewDoubleSort),
                               typeof(ListViewTextSort)
                           },
                4, System.Windows.Forms.SortOrder.Descending);
                    
                }
                if (diaryListView.SelectedItems.Count == 0 && diaryListView.Items.Count > 0)
                {
                    diaryListView.Items[0].Selected = true;
                }
            }
        }
    }
}


However, the listView is not populating as expected (the rows are empty), although if I run my mouse over the expected date column a tooltip appears with the correct data.

Can anyone here see why this sould be please?

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.