![]() |
![]() |
| Paypal | FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
|||||||
| Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
|
Herramientas | Buscar en Tema | Desplegado |
|
#7
|
|||
|
|||
|
El programa consta de dos Units
Unit 1: Codigo unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Grids, StdCtrls, Menus, cliente; type TForm1 = class(TForm) MainMenu1: TMainMenu; OpenDialog1: TOpenDialog; SaveDialog1: TSaveDialog; Archivo1: TMenuItem; Abrir1: TMenuItem; Guardar1: TMenuItem; Salir1: TMenuItem; Buscar: TButton; Salir: TButton; Agregar: TButton; verEditar: TButton; Eliminar: TButton; Label1: TLabel; Edit1: TEdit; StringGrid1: TStringGrid; Label13: TLabel; procedure Abrir1Click(Sender: TObject); procedure Guardar1Click(Sender: TObject); procedure Salir1Click(Sender: TObject); procedure BuscarClick(Sender: TObject); procedure SalirClick(Sender: TObject); procedure AgregarClick(Sender: TObject); procedure EliminarClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure StringGrid1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; Form2: TForm2; nu : TManejoSocios; nombreArchivo : String; buscarSocio : boolean; eliminarSocio : boolean; numeroDeRegistro : integer; volver : boolean; implementation {$R *.dfm} procedure TForm1.Abrir1Click(Sender: TObject); var cod : byte; var nomarchivo : string; begin nu := TManejoSocios.Create; OpenDialog1.Execute; nomarchivo:=form1.OpenDialog1.FileName; if nomarchivo = '' then begin exit end else begin {$I-} nu.AbrirArchivo(nomarchivo); {$I+} cod := IOResult; if cod=0 then begin form1.Label13.Caption := '00'; nombreArchivo := nomarchivo; end else begin exit end end; end; procedure TForm1.Guardar1Click(Sender: TObject); var nombreNuevo : string; begin Form1.SaveDialog1.Execute ; nombreNuevo:= Form1.SaveDialog1.FileName; if nombreNuevo = '' then begin showMessage('No se guardo con otro nombre'); exit; end else begin if nombreArchivo = '' then begin ShowMessage('No hay archivo abierto para copiar.'); end else begin nu.GuardarComo(nombreArchivo, nombreNuevo); end; end; end; procedure TForm1.Salir1Click(Sender: TObject); begin form1.Close; end; procedure TForm1.BuscarClick(Sender: TObject); begin if Form1.Label13.Caption = '00' then begin buscarSocio:= true; form1.Buscar.Enabled := true; ShowMessage('Ingrese el numero de NOMBRE en el campo NOMBRE y preciones el boton Aceptar.'); exit; end else begin ShowMessage('Primero hay que abrir el archivo'); //cod:= 1; end; end; procedure TForm1.SalirClick(Sender: TObject); begin if form1.Label13.Caption = '' then begin ShowMessage('No se puede cerrar el archivo porque no esta abierto.'); end else begin nu.CerrarArchivo ; form1.Label13.Caption := ''; nombreArchivo := ''; end; end; procedure TForm1.AgregarClick(Sender: TObject); begin Form2 := TForm2.Create(nil); Try Form2.ShowModal; Finally FreeAndNil(Form2); End; end; procedure TForm1.EliminarClick(Sender: TObject); begin if Form1.Label13.Caption = '00' then begin form2.Edit2.Enabled := false; form2.Edit3.Enabled := false; form2.Edit4.Enabled := false; form2.Edit5.Enabled := false; form2.Edit6.Enabled := false; ShowMessage('Precione el boton Eliminar y el Cliente sera eliminado.'); eliminarSocio := true; //habilitamos el boton. form1.Eliminar.Enabled := true; end else begin ShowMessage('Primero hay que abrir el archivo'); end; end; procedure TForm1.FormCreate(Sender: TObject); begin with StringGrid1 do begin // Título de las columnas Cells[0, 0] := 'APELLIDO NOMBRES'; Cells[1, 0] := 'SALDO'; Cells[2, 0] := 'TELEFONO'; Cells[3, 0] := 'EDAD'; end; end; procedure TForm1.StringGrid1Click(Sender: TObject); begin with StringGrid1 do begin // Título de las columnas Cells[0, 0] := 'APELLIDO NOMBRES'; Cells[1, 0] := 'SALDO'; Cells[2, 0] := 'TELEFONO'; Cells[3, 0] := 'EDAD'; end; end; end. |
|
|
Temas Similares
|
||||
| Tema | Autor | Foro | Respuestas | Último mensaje |
| Administración remota!! | acertij022 | Varios | 8 | 11-10-2006 21:33:18 |
| Administracion Interbase 7 | Rabata | Conexión con bases de datos | 1 | 13-10-2004 15:19:46 |
| Administracion de Versiones | JorgeBec | Varios | 2 | 10-09-2004 11:28:32 |
| Administracion remota | buitrago | Varios | 6 | 27-07-2004 19:57:12 |
| Ayuda con administracion de archivos | Waldo | API de Windows | 1 | 09-07-2004 19:18:12 |
|