Помогите исправить ошибку "Error 1 The name 'i' does not exist in the current context" - C#
Формулировка задачи:
Листинг программы
- private void button4_Click(object sender, EventArgs e)
- {
- for (i = 0; i <= пациентыDataGridView.ColumnCount - 1; i++)
- {
- for (j = 0; j <= пациентыDataGridView.RowCount - 1; j++)
- {
- пациентыDataGridView.Item(i, j).Style.BackColor = Color.White;
- пациентыDataGridView.Item(i, j).Style.ForeColor = Color.Black;
- }
- }
- for (i = 0; i <= пациентыDataGridView.ColumnCount - 1; i++)
- {
- for (j = 0; j <= пациентыDataGridView.RowCount - 1; j++)
- {
- if (strings.InStr(пациентыDataGridView.Item(i, j).Value, textBox1.Text))
- {
- пациентыDataGridView.Item(i, j).Style.BackColor = Color.AliceBlue;
- пациентыDataGridView.Item(i, j).Style.ForeColor = Color.Blue;
- }
- }
- }
- }
- }
- }
Решение задачи: «Помогите исправить ошибку "Error 1 The name 'i' does not exist in the current context"»
textual
Листинг программы
- private void button4_Click(object sender, EventArgs e)
- {
- for (int i = 0; i <= пациентыDataGridView.ColumnCount - 1; i++)
- {
- for (int j = 0; j <= пациентыDataGridView.RowCount - 1; j++)
- {
- пациентыDataGridView.Item[i, j].Style.BackColor = Color.White;
- пациентыDataGridView.Item[i, j].Style.ForeColor = Color.Black;
- }
- }
- for (int i = 0; i <= пациентыDataGridView.ColumnCount - 1; i++)
- {
- for (int j = 0; j <= пациентыDataGridView.RowCount - 1; j++)
- {
- string itemValue = пациентыDataGridView.Item[i, j].Value;
- if (value.Contains(textBox1.Text))
- {
- пациентыDataGridView.Item[i, j].Style.BackColor = Color.AliceBlue;
- пациентыDataGridView.Item[i, j].Style.ForeColor = Color.Blue;
- }
- }
- }
- }
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д