Mundarija Kirish Asosiy qism



Download 1,26 Mb.
bet5/6
Sana13.01.2022
Hajmi1,26 Mb.
#354342
1   2   3   4   5   6
Bog'liq
Kurs ishi

2.5. Dastur kodi

//---------------------------------------------------------------------------


#include

#pragma hdrstop


#include "Unit1.h"

#include "Unit3.h"

#include "Unit4.h"

#include "Unit5.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

#pragma resource "*.dfm"

TForm1 *Form1;

//---------------------------------------------------------------------------

__fastcall TForm1::TForm1(TComponent* Owner)

: TForm(Owner)

{

}



//---------------------------------------------------------------------------

void __fastcall TForm1::SpeedButton1Click(TObject *Sender)

{

Form1->Visible=false;



Form3->Visible=true;

}

//---------------------------------------------------------------------------



//---------------------------------------------------------------------------
#include

#pragma hdrstop


#include "Unit1.h"

#include "Unit3.h"

#include "Unit4.h"

#include "Unit5.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

#pragma resource "*.dfm"

TForm3 *Form3;

//---------------------------------------------------------------------------

__fastcall TForm3::TForm3(TComponent* Owner)

: TForm(Owner)

{

}



//---------------------------------------------------------------------------
void __fastcall TForm3::BitBtn1Click(TObject *Sender)

{

Form3->Visible=false;



Form4->Visible=true;

}

//---------------------------------------------------------------------------


void __fastcall TForm3::BitBtn2Click(TObject *Sender)

{

Form3->Visible=false;



Form5->Visible=true;

}

//---------------------------------------------------------------------------


//---------------------------------------------------------------------------


#include

#pragma hdrstop


#include "Unit1.h"

#include "Unit3.h"

#include "Unit4.h"

#include "Unit5.h"

#include "Unit6.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

#pragma resource "*.dfm"

TForm4 *Form4;

TSearchRec obn;

AnsiString amu;

//---------------------------------------------------------------------------

__fastcall TForm4::TForm4(TComponent* Owner)

: TForm(Owner)

{if (FindFirst("base/*.info",faAnyFile, obn)==0)

{

ComboBox1->Items->Add(obn.Name);



while (FindNext(obn) == 0)

{

ComboBox1->Items->Add(obn.Name);



}

ComboBox1->ItemIndex = 0;

Memo1->Text =ComboBox1->Items->Strings[0];

}

}



//---------------------------------------------------------------------------
void __fastcall TForm4::Button3Click(TObject *Sender)

{

Form4->Visible=false;



Form6->Visible=true;

}

//---------------------------------------------------------------------------


void __fastcall TForm4::ComboBox1Change(TObject *Sender)

{

int n = ComboBox1->ItemIndex;



AnsiString amu;

amu="base/"+ComboBox1->Items->Strings[n];

Memo1->Lines->LoadFromFile(amu);

}

//---------------------------------------------------------------------------



void __fastcall TForm4::BitBtn1Click(TObject *Sender) //+

{

Form4->Visible=false;



Form6->Visible=true;

}

//---------------------------------------------------------------------------


void __fastcall TForm4::BitBtn3Click(TObject *Sender) // delet

{

int n=ComboBox1->ItemIndex;



AnsiString delate;

delate="base/"+ComboBox1->Items->Strings[n];

if (MessageDlg("Ma'lumotlar o'chirilayapti, rozimisiz?",mtConfirmation,mbYesNoCancel,0)==6)

{DeleteFile(delate);

Memo1->Text=" ";

ComboBox1->Text=" ";}

}

//---------------------------------------------------------------------------


void __fastcall TForm4::BitBtn2Click(TObject *Sender) //obnavit

{

ComboBox1->Items->Clear();


if (FindFirst("Base/*.info",faAnyFile, obn)==0)

{

ComboBox1->Items->Add(obn.Name);



while (FindNext(obn) == 0)

{

ComboBox1->Items->Add(obn.Name);



}

ComboBox1->ItemIndex = 0;

Memo1->Text = ComboBox1->Items->Strings[0];

Memo1->Text=" ";

ComboBox1->Text=" ";

}

}



//---------------------------------------------------------------------------
void __fastcall TForm4::BitBtn4Click(TObject *Sender) //exit

{

Form4->Visible=false;



Form5->Visible=true;

}

//---------------------------------------------------------------------------



//---------------------------------------------------------------------------
#include

#pragma hdrstop


#include "Unit6.h"

#include "Unit4.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

#pragma resource "*.dfm"

TForm6 *Form6;

//---------------------------------------------------------------------------

__fastcall TForm6::TForm6(TComponent* Owner)

: TForm(Owner)

{RichEdit1->Text="";

}

//---------------------------------------------------------------------------


void __fastcall TForm6::Button1Click(TObject *Sender)

{

Form6->Visible=false;



Form4->Visible=true;

}

//---------------------------------------------------------------------------


void __fastcall TForm6::Button2Click(TObject *Sender)

{

Edit1->Text="";



RichEdit1->Text="";

}

//---------------------------------------------------------------------------



void __fastcall TForm6::Button3Click(TObject *Sender)

{

int xayat;



AnsiString keraga;

keraga = "base/"+Edit1->Text + ".info";

if ( FileExists(keraga) )

xayat = FileOpen(keraga,fmOpenWrite);

else

xayat = FileCreate(keraga);



FileClose(xayat);

if (Edit1->Text != "" )

{RichEdit1->Lines->SaveToFile(keraga);

MessageBoxA(Form6->Handle, "Ma'lumotlar bazaga yuklandi!", "Xabar", 0);

}

else


{MessageBoxA(Form6->Handle, "Fayl nomi xato!", "Xabar", 0);

}

}



//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include

#pragma hdrstop


#include "Unit1.h"

#include "Unit3.h"

#include "Unit4.h"

#include "Unit5.h"

#include "Unit6.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

#pragma resource "*.dfm"

TForm5 *Form5;

//---------------------------------------------------------------------------

__fastcall TForm5::TForm5(TComponent* Owner)

: TForm(Owner)

{

}

//---------------------------------------------------------------------------


void __fastcall TForm5::Button1Click(TObject *Sender)

{

Form1->Close();



Form3->Close();

Form4->Close();

Form5->Close();

Form6->Close();

}

//---------------------------------------------------------------------------



void __fastcall TForm5::Button2Click(TObject *Sender)

{

Form5->Visible=false;



Form1->Visible=true;

}

//---------------------------------------------------------------------------


2.6 Ma’lumotlar bazasi.


Dasturni yaratish jarayonida ma’lumotlar bazasi sifatida tashqi fayldan foydalanildi.

Buning uchun maxsus papka (katalog) ochildi va unga dastur ichidan aftomatik ravishda yo’l belgilandi:


int xayat;

AnsiString keraga;

keraga = "base/"+Edit1->Text + ".info";

if ( FileExists(keraga) )

xayat = FileOpen(keraga,fmOpenWrite);

else


xayat = FileCreate(keraga);

FileClose(xayat);


Har bir yangi qo’shilgan fayl *.info kengaytmasi bilan o’sha papkaga yuklanadi. Ikkita bir xil nomdagi fayl xosil bo’lsa avvalgi fayl aftomatik ravishda o’chib ketadi.
Ma’lumotlarni dasturiy ravishda o’chirganda ham ma’lumotlar saqlanayotgan fayl o’chib ketadi:
void __fastcall TForm4::BitBtn3Click(TObject *Sender)

{

int n=ComboBox1->ItemIndex;



AnsiString delate;

delate="base/"+ComboBox1->Items->Strings[n];

if (MessageDlg("Ma'lumotlar o'chirilayapti, rozimisiz?",mtConfirmation,mbYesNoCancel,0)==6)

{DeleteFile(delate);

Memo1->Text=" ";

ComboBox1->Text=" ";}

}




Download 1,26 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish