Note that there are some explanatory texts on larger screens.

plurals
  1. POList view column header index returns -1
    primarykey
    data
    text
    <p>I have a list view which i declared the column headers like below.</p> <pre><code> private System.Windows.Forms.ColumnHeader Debtorname; private System.Windows.Forms.ColumnHeader Message; private System.Windows.Forms.ColumnHeader Hpno; private System.Windows.Forms.ColumnHeader Status; private System.Windows.Forms.ColumnHeader Timestamp; private System.Windows.Forms.ColumnHeader sentBY; private System.Windows.Forms.ColumnHeader submitTime; private System.Windows.Forms.ColumnHeader debtorid; private System.Windows.Forms.ColumnHeader Account; private System.Windows.Forms.ColumnHeader Client; private System.Windows.Forms.ColumnHeader Batchno; </code></pre> <p>I populate the listviewitems like below.</p> <pre><code> ListViewItem lvi = new ListViewItem(new string[lstSMSReport.Columns.Count]); lvi.SubItems[Debtorname.Index].Text = myReader["debtorName"].ToString(); lvi.SubItems[Status.Index].Text = myReader["status"].ToString(); lvi.SubItems[Timestamp.Index].Text = myReader["timestamp"].ToString(); </code></pre> <p>When i run the above, i get the result i am expecting , however this two columnheaders below threw and exception.</p> <pre><code> lvi.SubItems[Client.Index].Text = myReader["clientname"].ToString(); lvi.SubItems[Batchno.Index].Text = myReader["batchno"].ToString(); </code></pre> <p>When i put the two in try and catch. Then i realized a -1 is return as the index for the two columns. I spent a couple of hours trying to figure out why but still couldn't.</p> <p>Please any suggestion would be appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload