Принятая 1 лаба

This commit is contained in:
Kirill 2024-10-09 19:42:11 +04:00
parent 29ef211385
commit 9b30023ed6
2 changed files with 15 additions and 13 deletions

View File

@ -93,10 +93,20 @@ namespace Components
var properties = typeof(T).GetProperties();
foreach (var obj in objects)
for (int i = 0; i < objects.Count; ++i)
{
var values = properties.Select(p => p.GetValue(obj, null)).ToArray();
dataGridView.Rows.Add(values);
var row = objects[i];
dataGridView.Rows.Add();
for (int j = 0; j < dataGridView.ColumnCount; ++j)
{
var property = properties.FirstOrDefault(p => p.Name == dataGridView.Columns[j].DataPropertyName);
if (property != null)
{
dataGridView.Rows[i].Cells[j].Value = property.GetValue(row, null);
}
}
}
}
}

View File

@ -45,16 +45,8 @@ namespace Components
}
set
{
if (value.HasValue)
{
checkBoxNull.Checked = false;
textBoxInteger.Text = value.ToString();
}
else
{
checkBoxNull.Checked = true;
textBoxInteger.Text = string.Empty;
}
checkBoxNull.Checked = !value.HasValue;
textBoxInteger.Text = value.HasValue ? value.ToString() : string.Empty;
}
}