Ver Mensaje Individual
  #5  
Antiguo 18-03-2013
joancmb joancmb is offline
Miembro
NULL
 
Registrado: sep 2012
Posts: 11
Reputación: 0
joancmb Va por buen camino
Is not a valid integer value

Buenos días,
Estoy realizando una pequeña aplicación con una serie de radio button los cuales tienen un valor númerico i el resultado sale reflejado en un text, el codigo que utilizo es el siguiente:

Código Delphi [-]
unit eqt;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Imaging.jpeg, Vcl.ExtCtrls,
  Vcl.StdCtrls, Vcl.DBCtrls, Vcl.Mask;

type
  TForm12 = class(TForm)
    Label2: TLabel;
    logo: TImage;
    Label7: TLabel;
    DBRadioGroup1: TDBRadioGroup;
    DBRadioGroup2: TDBRadioGroup;
    DBRadioGroup3: TDBRadioGroup;
    DBRadioGroup4: TDBRadioGroup;
    DBRadioGroup5: TDBRadioGroup;
    DBRadioGroup6: TDBRadioGroup;
    DBRadioGroup7: TDBRadioGroup;
    DBRadioGroup8: TDBRadioGroup;
    DBRadioGroup9: TDBRadioGroup;
    Label1: TLabel;
    DBEdit1: TDBEdit;
    Button1: TButton;
    Button2: TButton;
    procedure Button2Click(Sender: TObject);
    procedure DBRadioGroup1Change(Sender: TObject);
    procedure DBRadioGroup2Change(Sender: TObject);
    procedure DBRadioGroup3Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form12: TForm12;

implementation

{$R *.dfm}

procedure TForm12.Button2Click(Sender: TObject);
begin
Close;
end;

procedure TForm12.DBRadioGroup1Change(Sender: TObject);
begin
  //showmessage(form12.DBRadioGroup1.Value);
  //showmessage(form12.DBRadioGroup2.Value);
  //form12.DBEdit1.Text := string(form12.DBRadioGroup1.Value) + string(form12.DBRadioGroup2.Value);
  //form12.DBEdit1.Text := IntToStr(TryStrToInt(form12.DBRadioGroup1.Value)+ StrToInt(form12.DBRadioGroup2.Value)+ StrToInt(form12.DBRadioGroup3.Value) + 
  //  StrToInt(form12.DBRadioGroup4.Value) + StrToInt(form12.DBRadioGroup5.Value) + StrToInt(form12.DBRadioGroup6.Value) + StrToInt(form12.DBRadioGroup7.Value)+ 
  //  StrToInt(form12.DBRadioGroup8.Value)+ StrToInt(form12.DBRadioGroup9.Value));
  form12.DBEdit1.Text := IntToStr(StrToInt(form12.DBRadioGroup1.Value) + StrToInt(form12.DBRadioGroup2.Value) + StrToInt(form12.DBRadioGroup3.Value));
  end;

procedure TForm12.DBRadioGroup2Change(Sender: TObject);
begin
  form12.DBEdit1.Text := IntToStr(StrToInt(form12.DBRadioGroup2.Value)+ StrToInt(form12.DBRadioGroup1.Value)+ StrToInt(form12.DBRadioGroup3.Value));
end;

procedure TForm12.DBRadioGroup3Change(Sender: TObject);
begin
  form12.DBEdit1.Text := IntToStr(StrToInt(form12.DBRadioGroup3.Value)+ StrToInt(form12.DBRadioGroup1.Value)+ StrToInt(form12.DBRadioGroup2.Value));
end;

end.

Y cada vez que escojo un radio button me sale el siguiente mensaje: '''' is not valid integer value, en cambio me realiza la suma bien y el resultado aparece en el text, alguién se le ocurre que es lo que esta fallando.

Gracias.

Última edición por Casimiro Notevi fecha: 18-03-2013 a las 13:13:22.
Responder Con Cita