| |

VerySource

 Forgot password?
 Register
Search
View: 994|Reply: 5

Questions about rows in dataGridView

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-7 17:30:01
| Show all posts |Read mode
How can I tell if the content of a row in the dataGridView is empty, thank you
Reply

Use magic Report

0

Threads

110

Posts

63.00

Credits

Newbie

Rank: 1

Credits
63.00

 China

Post time: 2020-3-31 14:00:01
| Show all posts
Does it mean that all columns of the row are empty?
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-6 03:45:01
| Show all posts
I want to ask a question: how can I add the name of each row to the first column of the DataGridView, thank you!
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-6 09:00:01
| Show all posts
bool isNullRow;
            for (int i = 0; i <this.dataGridView1.Rows.Count; i++)
            {
                isNullRow = true;
                foreach (DataGridViewCell cell in this.dataGridView1.Rows[i].Cells)
                {
                    if (cell.EditedFormattedValue != null&&string.IsNullOrEmpty(cell.EditedFormattedValue.ToString()) == false)
                    {
                        isNullRow = false;
                        break;
                    }
                }
                if (isNullRow)
                {
                    //All columns in the current row are empty.
                }
            }
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-6 09:15:01
| Show all posts
[Quote=Quote the reply from17132929on the 2nd floor:]
I want to ask a question: how can I add the name of each row to the first column of the DataGridView, thank you!
[/Quote]
Loop the row information and add it to the column name!
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-6 09:30:01
| Show all posts
Writing on the top third floor. . . . . . . . . .
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list