简体   繁体   中英

Selecting in arrays the elements from a column of a datagridview

I have a DataGridView with 2 columns, with 150 datas => 150 rows.

What I want to do is to manage to take all the values from the 1st column and adding them into an array, like this

for ( int i=1; i<150; i++) 
    array[i] = ..... ?! .... ;

If it is Windows Forms DataGridView you can use :-

for ( int i=1; i<150; i++) 
  array[i] = MyDataGridView[1,i].value ;
or
  array[i]=  MyDataGridView.Rows[i].Cells[1].Value;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM