Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

Data Grid Error

$
0
0

I get an error accessing the data grid that the index is out of range. I have done this many times so the error is unusual. The only factor different in my many uses of data grid is that I have two data grids on a single form. I'll provide some detail.

Here is the code

invoke self::dataGridView2::Rows::Clear
set dataGridView2::ColumnCount = 3
set dataGridView2::Columns[0]::Width = 100 *> Hole
set dataGridView2::Columns[1]::Width = 150 *> player
set dataGridView2::Columns[2]::Width = 100 *> results

perform varying sub1 from 1 by 1 until sub1 > 9
   subtract 1 from sub1 giving line-number (this gives zero)
   move 0 to column-index
   set dataGridView2::CurrentCell = dataGridView2::Rows[line-number]::Cells[column-index];

The above set datagridview2 fails with 

An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
Additional information: Index was out of range. Must be non-negative and less than the size of the collection

The following (if you can see it) to me indicates line-number and column-index are correct

Any help? 


Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>