fix select and input components

This commit is contained in:
ShabOl 2024-09-11 11:44:28 +04:00
parent 13d3b1c1b2
commit 1ca6980b3a
3 changed files with 5 additions and 24 deletions

View File

@ -28,7 +28,7 @@ namespace FormsTesting
private void InitializeInputComponent() private void InitializeInputComponent()
{ {
InputComponent.IntValue = 1848; InputComponent.IntValue = 1500;
} }
private void InitializeGridComponent() private void InitializeGridComponent()

View File

@ -43,13 +43,9 @@ namespace ShabComponentsLibrary
} }
set set
{ {
if (value is null) SetNullState(value is null, true);
if (value is not null)
{ {
SetNullState(true);
}
else
{
SetNullState(false);
MainTextBox.Text = value.ToString(); MainTextBox.Text = value.ToString();
} }
} }
@ -66,16 +62,8 @@ namespace ShabComponentsLibrary
private void SetNullState(bool IsNull, bool ClearText = false) private void SetNullState(bool IsNull, bool ClearText = false)
{ {
if (IsNull) IsNullCheckBox.Checked = IsNull;
{ MainTextBox.Enabled = !IsNull;
IsNullCheckBox.Checked = true;
MainTextBox.Enabled = false;
}
else
{
IsNullCheckBox.Checked = false;
MainTextBox.Enabled = true;
}
if (ClearText) if (ClearText)
{ {

View File

@ -95,13 +95,6 @@
Grid.Rows[NewRowIndex].Cells[Column.Index].Value = Value; Grid.Rows[NewRowIndex].Cells[Column.Index].Value = Value;
} }
} }
foreach (DataGridViewColumn Column in Grid.Columns)
{
var Property = Properties.FirstOrDefault(x => x.Name == Column.Name);
if (Property == null)
throw new InvalidOperationException($"В типе {Type.Name} не найдено свойство с именем {Column.Name}");
}
} }
} }
} }