Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 10-05-2013
frankmanuel06 frankmanuel06 is offline
Miembro
NULL
 
Registrado: abr 2013
Posts: 12
Poder: 0
frankmanuel06 Va por buen camino
tengo un error con un programa usando array

saludos! mi nombre es frank y, tengo un error en un programa que estaba haciendo usando los array, bueno el codigo es el siguiente:

Código Delphi [-]
unit tvendedor_Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    txtcodigo: TEdit;
    Label2: TLabel;
    txtnombre: TEdit;
    Label3: TLabel;
    txtsueldo: TEdit;
    Label4: TLabel;
    txtcomision: TEdit;
    Guardar: TButton;
    Imprimir: TButton;
    procedure txtcodigoKeyPress(Sender: TObject; var Key: Char);
    procedure GuardarClick(Sender: TObject);
    procedure txtsueldoChange(Sender: TObject);
    procedure ImprimirClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
  Tvendedor = Record
  codigo:integer;
  nombre:string;
  sueldo:double;
  comision:double;
  end;

var
  Form1: TForm1;
  vendedores:array[1..3] of Tvendedor;

implementation

{$R *.dfm}

procedure TForm1.txtcodigoKeyPress(Sender: TObject; var Key: Char);
begin
if not (key in ['1'..'3',#8]) then
key:=#0;
end;

procedure TForm1.GuardarClick(Sender: TObject);
begin
vendedores[strtoint(txtcodigo.text)].codigo:=strtoint(txtcodigo.text);
vendedores[strtoint(txtcodigo.text)].nombre:=txtnombre.text;
vendedores[strtoint(txtcodigo.text)].sueldo:=strtofloat(txtsueldo.text);
vendedores[strtoint(txtcodigo.text)].comision:=strtofloat(txtsueldo.text)*0.10;

txtcodigo.text:='';
txtnombre.text:='';
txtsueldo.text:='';
txtcomision.text:='';
end;

procedure TForm1.txtsueldoChange(Sender: TObject);
begin
if (txtsueldo.text<>'') then
txtcomision:=floattostr(strtofloat(txtsueldo.text)*0.10); //aqui es que me da error

end;
procedure TForm1.ImprimirClick(Sender: TObject);
var
cont:integer;
begin
for cont:1 to 3 do
showmessage(inttostr(vendedores[cont].codigo+'    '+vendedores[cont].nombre+'   '+floattostr(vendedores[cont].sueldo)+'   '+floattostr(vendedores[cont].comision));
 End;

end;

End.

bueno gracias de antemano y espero me ayuden .
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Hola Tengo un error con mi programa delphi sql MoisesGeek666 Conexión con bases de datos 6 03-12-2012 20:06:20
Tengo algo de código y necesito un programa rad01 OOP 12 08-02-2010 22:45:18
Averiguar si tengo instalado un programa mauqu Varios 2 02-05-2007 19:42:52
Crear dll para un programa del que no tengo entero el código fuente entero seduerey Varios 1 02-05-2007 13:58:08
Tengo un error de sentencia please Epunamun Conexión con bases de datos 2 29-07-2005 02:05:24


La franja horaria es GMT +2. Ahora son las 15:41:18.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi