3.3. , ( ).
3.4. , Filter OpenFileDialog SaveFileDialog , .
3.5. . , , ? Yes No . Yes , No .
13.3. .
1- . .
MainMenuStrip Δ.
, SearchNameForm.cs. . 13.5.
, , TextBox , MultiLine , (. 13.6).
, StartPosition CenterParent.
Name TextBox , ( ); SearchButton; TextBox ResultsTextBox. ResultsTextBox : ScrollBars = Both ( ), ReadOnly = True ( ). TabIndex ( , 0).
2- . .
SearchNameForm PhoneNote.
public partial class SearchNameForm: Form
{
List<Note> PhoneNote;
( ).
public SearchNameForm(List<Note> _PhoneNote)
{
InitializeComponent();
PhoneNote = _PhoneNote;
}
Δ MainForm:
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
SearchNameForm _Search = new SearchNameForm(PhoneNote);
_Search.ShowDialog();
}
, , Δ PhoneNote. .
SearchNameForm:
|
|
private void SearchButton_Click(object sender, EventArgs e)
{
//
ResultsTextBox.Text = "";
//
int i = 0;
// for - foreach
foreach (Note MyRecord in PhoneNote)
{
//
if (MyRecord.LastName.Contains(LastNameTextBox.Text) &&
MyRecord.Name.Contains(NameTextBox.Text) && MyRecord.Patronymic.Contains(PatronymicTextBox.Text))
{
//
i++;
//
ResultsTextBox.Text = ResultsTextBox.Text + i.ToString() + ". " + MyRecord.LastName + " " + MyRecord.Name + " " + MyRecord.Patronymic + ", . " + MyRecord.Street + ", ." + MyRecord.House + ", . " + MyRecord.Flat + ", . " + MyRecord.Phone + "\r\n";
}
}
// ,
if (i == 0) ResultsTextBox.Text = ",
, ! ";
}
. ResultsTextBox, Text. i ( 0). foreach , PhoneNote, Contains () , ( LastName, Name Patronymic ), , ResultsTextBox. , , .
, . . Close ().
. .