hallo,
per Button wird folgendes in die erste Zeile geschrieben:
Spalte 0 -> 1
Spater 1 -> "blalbl"
Spalte 2 -> 100
Spalte 3 -> 19
Spalte 4 und 5 wird nicht angefasst.
Dann drücke ich folgenden Button:
C#-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19:
| private void button41_Click(object sender, EventArgs e) {
for (int counter = 0; counter < (dataGridView1.Rows.Count); counter++) {
if (dataGridView1.Rows[counter].Cells[3].Value != null && dataGridView1.Rows[counter].Cells[5].Value != null) {
MessageBox.Show(dataGridView1.Rows[counter].Cells[5].Value.ToString()); }
} } |
Wenn Cell 3 und 5 NICHT leer ist, DAAAAAAANNNNNNNNNN soll die Messagesbox angehen !!!!
Es kommt aber trotzdem die Messagesbox und weisem Inhalt.
Dann kommt der Crash.