13.
MessageBoxIcon::Exclamation);} }
5-qadam. 3.30- rasmdagi File mеnyusidagi Saqlash bo‘limining onclick
hodisasiga quyidagi kodlar yoziladi:
1.
private: System::Void saqlashToolStripMenuItem_Click(System::Object^
2.
sender, System::EventArgs^ e) {
3.
saveFileDialog1->FileName = openFileDialog1->FileName;
4.
if (saveFileDialog1->ShowDialog() ==Windows::Forms:: DialogResult::OK)
Zapis(); }
bu yerda Zapis() funksiyasi chaqirilgan. Zapis() funksiyasi quyidagicha:
1.
void Zapis(){
2.
try{
3.
auto Pisatеl = gcnewIO::StreamWriter(saveFileDialog1->FileName, false,
4.
System::Text::Encoding::GetEncoding(1251));
5.
Pisatеl->Write(textBox1->Text);
112
Oybek Mallayev
6.
Pisatеl->Close(); textBox1->Modified = false; }
7.
catch (Exception^ Situasiya){
8.
MessageBox::Show(Situasiya->Message, "Hatolik", MessageBoxButtons::OK,
9.
MessageBoxIcon::Exclamation);}
“Chiqish” tugmasi kodi quyidacha :
1.
Do'stlaringiz bilan baham: |