I am using C#NET2008, Window Application with LISTVIEW.
I encounter an interesting problem while trying to retrieve 2 ListView SubItem column data of ORDERDATE and INVOICE for filling the TEXTBOX Control.
This is the ListView data display
CustID OrderDate Invoice
54321 25/12/2010 45363
56441 16/12/2010 45362
-----------------------------------------
After retrieving the SubItem Data into the TextBox instead of of just the OrderDate and Invoice data. This is what appeared on the TextBox:
ListView1SubItem: {25/12/2010}
ListView1SubItem: {45363}
Here are the coding that caused the above result.
Expand|Select|Wrap|Line Numbers
- private void listView1_SelectedIndexChanged(object sender, EventArgs e)
- {
- txtOrderDate.Text = Convert.ToString(this.listView1.SelectedItems[0].SubItems[1]);
- txtInvoice.Text = Convert.ToString(this.listView1.SelectedItems[0].SubItems[2]);
- }