Beispiel #1
0
        // Example 22-5. Making list view items reflect changes
        private void UpdateListViewItem(int itemIndex)
        {
            ListViewItem item  = entriesListView.Items[itemIndex];
            ToDoEntry    entry = entries[itemIndex];

            item.SubItems[0].Text = entry.Title;
            item.SubItems[1].Text = entry.DueDate.ToShortDateString();
        }
Beispiel #2
0
        private void CreateNewItem()
        {
            ToDoEntry newEntry = (ToDoEntry)entriesSource.AddNew();

            newEntry.Title   = "New entry";
            newEntry.DueDate = DateTime.Now;
            entriesSource.ResetCurrentItem();
        }
        private void UpdateListViewItem(int itemIndex)
        {
            ListViewItem item  = entriesListView.Items[itemIndex];
            ToDoEntry    entry = entries[itemIndex];

            item.SubItems[0].Text = entry.Title;
            if (dueDatePicker.Checked == true)
            {
                item.SubItems[1].Text = entry.DueDate.ToShortDateString();
            }
            else
            {
                item.SubItems[1].Text = "";
            }
        }
        private void CreateNewItem()
        {
            if (deleteButton.Enabled == false)
            {
                dueDatePicker.Enabled   = true;
                deleteButton.Enabled    = true;
                descriptionText.Enabled = true;
                titleText.Enabled       = true;
            }

            ToDoEntry newEntry = (ToDoEntry)entriesSource.AddNew();

            newEntry.Title = "New Entry";
            entriesSource.ResetCurrentItem();
        }