We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

foreach loop

Thread ID:

Created:

Updated:

Platform:

Replies:

45639 Jun 26,2006 11:18 AM Jun 26,2006 03:12 PM Windows Forms 2
loading
Tags: GridControl
Jesse Marek
Asked On June 26, 2006 11:18 AM

Is it possible to iterate through all the cells of the grid with a foreach loop? If not, is there a recommended alternative process to do when we want to iterate through all the cells?

Administrator [Syncfusion]
Replied On June 26, 2006 01:37 PM

Hi Jesse, No, It is not possible to iterate through all the cells of the grid with a foreach loop. You can use this code to iterate all the cells in a grid. Here is a code snippet. for(int i = 0 ;i <= this.grid.Model.RowCount;i++) { for(int j=0;j< this.grid.Model.Colcount;j++) { //To acess the cell using this code. Console.WriteLine (this.grid.Model[i,j].Text); } } Let me know if this helps. Best Regards, Haneef

Jesse Marek
Replied On June 26, 2006 03:12 PM

Thanks. The code works great. (It''s a <= in both for loops, though.) >Hi Jesse, > >No, It is not possible to iterate through all the cells of the grid with a foreach loop. You can use this code to iterate all the cells in a grid. Here is a code snippet. > >for(int i = 0 ;i <= this.grid.Model.RowCount;i++) >{ > for(int j=0;j< this.grid.Model.Colcount;j++) > { > //To acess the cell using this code. > Console.WriteLine (this.grid.Model[i,j].Text); > } >} > >Let me know if this helps. >Best Regards, >Haneef

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;