I have a ListView element in a form called Form1, which I have linked to another form called Form2, I have set up my code for a particlar event as follows:
Form1.ToDoList.AddTask(Form1.ToDoList.task_list[task_ctr]);
ListViewItem item_n = new ListViewItem(Form1.ToDoList.task_list[task_ctr].title);
item_n.SubItems.Add(Convert.ToString(Form1.ToDoList.task_list[task_ctr].deadline));
item_n.SubItems.Add(Convert.ToString(Form1.ToDoList.task_list[task_ctr].priority));
if (Form1.ToDoList.task_list[task_ctr].complete == true)
item_n.SubItems.Add("Yes");
if(Form1.ToDoList.task_list[task_ctr].complete == false)
item_n.SubItems.Add("No");
form_1.listView1.Items.Add(item_n);
Text for listView item_n won't display in WinForms C#, but the text for the sub items will. When I change the line where item_n is initialised as follows:
ListViewItem item_n = new ListViewItem("example text");
It displays fine.
Any help would be appreciated.
Aucun commentaire:
Enregistrer un commentaire