3.7. :
;
;
;
;
.
3.8. .
13.5. .
1- . .
. , . , , .
, , AddForm, .
2- . .
AddForm , enum ( namespace Lab13, , , ).
public enum AddOrEdit
{
Add,
Edit
}
.
if (PhoneNote.Count > 0)
{
// - Note
Note MyRecord = new Note();
//
// ( )
MyRecord.LastName = LastNameTextBox.Text;
MyRecord.Name = NameTextBox.Text;
MyRecord.Patronymic = PatronymicTextBox.Text;
MyRecord.Phone = PhoneMaskedTextBox.Text;
MyRecord.Street = StreetTextBox.Text;
MyRecord.House = (ushort)HouseNumericUpDown.Value;
MyRecord.Flat = (ushort)FlatNumericUpDown.Value;
//
AddForm _AddForm = new AddForm(MyRecord, AddOrEdit.Edit);
_AddForm.ShowDialog();
//
PhoneNote[current] = _AddForm.MyRecord;
}
PrintElement();
. , MyRecord . AddForm MyRecord , . AddForm . , PrintElement (), , MainForm.
. AddForm AddOrEdit.Add.
AddForm _AddForm = new AddForm(MyRecord, AddOrEdit.Add);
AddForm. , MyRecord.
AddForm:
|
|
public AddForm(Note _MyRecord, AddOrEdit MyType)
{
InitializeComponent();
MyRecord = _MyRecord;
//
if (MyType == AddOrEdit.Add)
{
Text = " ";
AddButton.Text = "";
}
else //
{
Text = " ";
AddButton.Text = "";
//
LastNameTextBox.Text = MyRecord.LastName;
NameTextBox.Text = MyRecord.Name;
PatronymicTextBox.Text = MyRecord.Patronymic;
PhoneMaskedTextBox.Text = MyRecord.Phone;
StreetTextBox.Text = MyRecord.Street;
HouseNumericUpDown.Value = MyRecord.House;
FlatNumericUpDown.Value = MyRecord.Flat;
}
}
. , . , Text . , Text , MyRecord, .
.
. , .