Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
- #include "Unit1.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TForm1 *Form1;
- int i = 0;
- //---------------------------------------------------------------------------
- __fastcall TForm1::TForm1(TComponent* Owner)
- : TForm(Owner)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::FormCreate(TObject *Sender)
- {
- StringGrid1->Cells[0][0]="Meno";
- StringGrid1->Cells[1][0]="Priezvisko";
- StringGrid1->Cells[2][0]="Trieda";
- StringGrid1->Cells[3][0]="Dátum narodenia";
- StringGrid1->Cells[4][0]="Číslo";
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Button1Click(TObject *Sender)
- {
- if ( edtF->Text != "" && edtL->Text != "" && edtC->Text != "" && sedtD->Value != 0 && sedtM->Value != 0 && sedtY->Value != 0 ) {
- i++;
- StringGrid1->Cells[0][i]=edtF->Text;
- StringGrid1->Cells[1][i]=edtL->Text;
- StringGrid1->Cells[2][i]=edtC->Text;
- StringGrid1->Cells[3][i]=IntToStr(sedtD->Value)+"."+IntToStr(sedtM->Value)+"."+IntToStr(sedtY->Value);
- StringGrid1->Cells[4][i]=IntToStr(random(100));
- StringGrid1->RowCount++;
- edtF->Text = "";
- edtL->Text = "";
- edtC->Text = "";
- sedtD->Value = 0;
- sedtM->Value = 0;
- sedtY->Value = 0;
- edtF->SetFocus();
- } else ShowMessage("Vyplnte vsetky polia !!!!!");
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::StringGrid1SelectCell(TObject *Sender, int ACol, int ARow,
- bool &CanSelect)
- {
- if ( StringGrid1->Cells[ACol][ARow] != "" ) {
- StringGrid1->Cells[ACol][ARow] = InputBox("Zmena udajov v tabulke","Data",StringGrid1->Cells[ACol][ARow]);
- } else ShowMessage("Nemôžete upravovať tabuľku ak tam nič nieje :)");
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Button2Click(TObject *Sender)
- {
- for (i = 1; i < StringGrid1->RowCount-1; i++) {
- ListBox1->Items->Add(StringGrid1->Cells[0][i]);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Button3Click(TObject *Sender)
- {
- StringGrid2->RowCount = StringGrid1->RowCount;
- for (i = 0; i < StringGrid1->RowCount-1; i++) {
- StringGrid2->Cells[0][i]=StringGrid1->Cells[0][i];
- StringGrid2->Cells[1][i]=StringGrid1->Cells[1][i];
- StringGrid2->Cells[2][i]=StringGrid1->Cells[2][i];
- StringGrid2->Cells[3][i]=StringGrid1->Cells[3][i];
- StringGrid2->Cells[4][i]=StringGrid1->Cells[4][i];
- }
- }
- //---------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment