datagridview - C# Foreach Loop - Continue Issue -


I have a problem with an ongoing statement in my C # front loop.

I want to check it if there is a blank cell in the DataGrade view, and if so, then leave printing the value and check the next cell.

Help greatly appreciated.

Code here:

  foreach (this data.GridView1.Rows in the DataDridViewRow line) {foreach (DataGridViewCell cell in row.Cells) {if (cell.Size.IsEmpty ) {Continue; MessageBox.Show (cell.Value.ToString ()); }}  

OK, you are currently checking that the cell's Size is zero in a grid, each column has the same width in the cell and each cell has the same height (usually, anyway) in a row.

For example, if you type value :

  if (cell.Value == zero) cell. value. Ecloss ("")) {continue; }  

Tweak it for any other representation of "blank" values, which you are interested in. If there are too many, you want to write a specific method for it, and call it check:

  if (iyactical value (cell.view)) {continue; }  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -