some fixes

This commit is contained in:
357Sharonov 2024-09-05 15:30:28 +04:00
parent 1c98fe8e19
commit b9758bf437
3 changed files with 3 additions and 21 deletions

View File

@ -45,15 +45,6 @@ namespace FormLibrary
{ {
SelectedItemChanged?.Invoke(this, EventArgs.Empty); SelectedItemChanged?.Invoke(this, EventArgs.Empty);
} }
public void PopulateListBox(ListBox listBox, List<string> items)
{
listBox1.Items.Clear();
foreach (var item in items)
{
listBox.Items.Add(item);
}
}
public void PopulateListBox(List<string> items) public void PopulateListBox(List<string> items)
{ {
listBox1.Items.Clear(); listBox1.Items.Clear();

View File

@ -16,10 +16,8 @@ namespace FormLibrary
{ {
public partial class IntegerInputControl : UserControl public partial class IntegerInputControl : UserControl
{ {
// Событие, вызываемое при изменении значения в TextBox
public event EventHandler? ValueChanged; public event EventHandler? ValueChanged;
// Событие, вызываемое при изменении состояния CheckBox
public event EventHandler? CheckBoxChanged; public event EventHandler? CheckBoxChanged;
public IntegerInputControl() public IntegerInputControl()
@ -57,18 +55,11 @@ namespace FormLibrary
} }
set set
{ {
if (value == null) if(value is not null)
{ {
checkBoxNull.Checked = true;
textBoxInput.Enabled = false;
textBoxInput.Text = string.Empty;
}
else
{
checkBoxNull.Checked = false;
textBoxInput.Enabled = true;
textBoxInput.Text = value.ToString(); textBoxInput.Text = value.ToString();
} }
checkBoxNull.Checked = value is null;
} }
} }

View File

@ -100,7 +100,7 @@ namespace Forms
{ {
new Student { Group = "Пибд-33", FullName = "Иванов Иван Иванович", Course = 3 }, new Student { Group = "Пибд-33", FullName = "Иванов Иван Иванович", Course = 3 },
new Student { Group = "Пибд-33", FullName = "Петров Петр Петрович", Course = 2 }, new Student { Group = "Пибд-33", FullName = "Петров Петр Петрович", Course = 2 },
new Student { Group = "Пибд-33", FullName = "Сидоров Сидор Сидорович", Course = 1 } new Student { Group = "Пибд-33", FullName = "Антонов Антон Антонович", Course = 1 }
}; };
valueTableControl1.FillData(students); valueTableControl1.FillData(students);