I am using WinForms / VS2010 c # to create a list view with 12 columns and 8 rows. Here is the snippet from WinForms's auto-coded file:
/// & lt; Summary & gt; /// The essential method for designer support - Do not modify the contents of this method /// with the code editor. /// & lt; / Summary & gt; Private Zero initial group () {this.listView1 = New system.indo.form.listview (); .....} Then, in the Form1.cs file, I have the following method:
// public in my form1.cs file Zero list view1_Populate () {var columnIndex = listView1.Columns [2]. Indexes; Int counter = 0; Forehatch (List item item list 1. Items in item) {if (item soubiites [column index]. Text == "2") {counter + = 100; Item.SubItems [columnIndex]. Text = counter.ToString (); }}} But I do not set the object reference to an instance of an object when the code hits the line: var columnIndex = listView1. [2] .index; What am I doing wrong (in addition to trying to learn C # at 54 years old!)?
This is not clear from your question which is referred to as zero. But if you add the following to this line var column index = list. Column [2]. Indexes; You can get a clear understanding of how wrong it is. if (ListView1 == faucet) Throw new exception ("List view 1 is zero"); If (listView1.Columns == zero) throw a new exception ("the column is empty"); If (listView1.Columns.Length & lt; 3) throw a new exception ("column length is out of range");
Comments
Post a Comment