83 lines
2.3 KiB
C++
83 lines
2.3 KiB
C++
//---------------------------------------------------------------------------
|
|
#include <vcl\vcl.h>
|
|
#pragma hdrstop
|
|
|
|
#include "busqueda.h"
|
|
#include "telefonos.h"
|
|
//---------------------------------------------------------------------------
|
|
#pragma resource "*.dfm"
|
|
TForm2 *Form2;
|
|
//---------------------------------------------------------------------------
|
|
__fastcall TForm2::TForm2(TComponent* Owner)
|
|
: TForm(Owner)
|
|
{
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
void __fastcall TForm2::Button4Click(TObject *Sender)
|
|
{
|
|
Close();
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
void __fastcall TForm2::Button5Click(TObject *Sender)
|
|
{
|
|
Table1->Prior();
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
void __fastcall TForm2::Button1Click(TObject *Sender)
|
|
{
|
|
Table1->Post();
|
|
Table1->Insert();
|
|
DBEdit1->SetFocus();
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
void __fastcall TForm2::Button2Click(TObject *Sender)
|
|
{
|
|
Table1->Delete();
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
void __fastcall TForm2::Button3Click(TObject *Sender)
|
|
{
|
|
TForm4 *Busqueda;
|
|
Busqueda = new TForm4(this);
|
|
busca = 1;
|
|
Busqueda->Table1->TableName = "telefonos.db";
|
|
Busqueda->Table1->Active=true;
|
|
Busqueda->ShowModal();
|
|
delete Busqueda;
|
|
Table1->First();
|
|
Table1->MoveBy(direccion);
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
|
|
void __fastcall TForm2::Button6Click(TObject *Sender)
|
|
{
|
|
Table1->Next();
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
void __fastcall TForm2::FormClose(TObject *Sender, TCloseAction &Action)
|
|
{
|
|
if(Table1->State == dsInsert && Table1->Modified == true)
|
|
{
|
|
switch(MessageBox(Handle,"No guardó los datos ¿Desea Guardarlos?", "Atención" ,MB_YESNOCANCEL))
|
|
{
|
|
case 6:
|
|
Table1->Post();
|
|
break;
|
|
|
|
default:
|
|
Table1->Cancel();
|
|
break;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Table1->Cancel();
|
|
}
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
void __fastcall TForm2::FormCreate(TObject *Sender)
|
|
{
|
|
Table1->Insert();
|
|
}
|
|
//---------------------------------------------------------------------------
|