Fecha y hora actual: Miércoles 29 Ene 2020 16:52
Índice del Foro

Foros de programación informática, diseño gráfico y Web

En esta comunidad intentaremos dar soporte de programación a todos los niveles, desde principiantes a profesionales de la informática, desarrollo de programas, programación web y mucho más.

Is not a valid integer value

Responder al Tema

Índice del Foro > Delphi > Is not a valid integer value

Autor Mensaje
Joan Carles



Registrado: 18 Mar 2013
Mensajes: 4

Mensaje Publicado: Lunes 18 Mar 2013 13:08

Título del mensaje: Is not a valid integer value

Responder citando

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.

Volver arriba
Ver perfil del usuario Enviar mensaje privado
Joan Carles



Registrado: 18 Mar 2013
Mensajes: 4

Mensaje Publicado: Martes 19 Mar 2013 17:29

Título del mensaje: Re: Is not a valid integer value

Responder citando

Hola a todos y gracias por vuestra ayuda, aquí dejo la solución que he aplicado:

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, Unit2;

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);
procedure DBRadioGroup4Change(Sender: TObject);
procedure DBRadioGroup5Change(Sender: TObject);
procedure DBRadioGroup6Change(Sender: TObject);
procedure DBRadioGroup7Change(Sender: TObject);
procedure DBRadioGroup8Change(Sender: TObject);
procedure DBRadioGroup9Change(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));
if (form12.DBRadioGroup1.Value <> '') and (form12.DBRadioGroup2.Value <> '') and (form12.DBRadioGroup3.Value <> '') and (form12.DBRadioGroup4.Value <> '') and (form12.DBRadioGroup5.Value <> '') and (form12.DBRadioGroup6.Value <> '')and (form12.DBRadioGroup7.Value <> '') and (form12.DBRadioGroup8.Value <> '') and (form12.DBRadioGroup9.Value <> '') then
form12.DBEdit1.Text := inttostr(strtoint(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));

end;

procedure TForm12.DBRadioGroup2Change(Sender: TObject);
begin
if (form12.DBRadioGroup1.Value <> '') and (form12.DBRadioGroup2.Value <> '') and (form12.DBRadioGroup3.Value <> '') and (form12.DBRadioGroup4.Value <> '') and (form12.DBRadioGroup5.Value <> '') and (form12.DBRadioGroup6.Value <> '')and (form12.DBRadioGroup7.Value <> '') and (form12.DBRadioGroup8.Value <> '') and (form12.DBRadioGroup9.Value <> '') then
form12.DBEdit1.Text := IntToStr(StrToInt(form12.DBRadioGroup2.Value)+ StrToInt(form12.DBRadioGroup1.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 := form12.DBRadioGroup1.Value + form12.DBRadioGroup2.Value + form12.DBRadioGroup3.Value;
end;

procedure TForm12.DBRadioGroup3Change(Sender: TObject);
begin
if (form12.DBRadioGroup1.Value <> '') and (form12.DBRadioGroup2.Value <> '') and (form12.DBRadioGroup3.Value <> '') and (form12.DBRadioGroup4.Value <> '') and (form12.DBRadioGroup5.Value <> '') and (form12.DBRadioGroup6.Value <> '')and (form12.DBRadioGroup7.Value <> '') and (form12.DBRadioGroup8.Value <> '') and (form12.DBRadioGroup9.Value <> '') then
form12.DBEdit1.Text := IntToStr(StrToInt(form12.DBRadioGroup3.Value)+ StrToInt(form12.DBRadioGroup1.Value) + StrToInt(form12.DBRadioGroup2.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 := form12.DBRadioGroup1.Value + form12.DBRadioGroup2.Value + form12.DBRadioGroup3.Value;
end;

procedure TForm12.DBRadioGroup4Change(Sender: TObject);
begin
if (form12.DBRadioGroup1.Value <> '') and (form12.DBRadioGroup2.Value <> '') and (form12.DBRadioGroup3.Value <> '') and (form12.DBRadioGroup4.Value <> '') and (form12.DBRadioGroup5.Value <> '') and (form12.DBRadioGroup6.Value <> '')and (form12.DBRadioGroup7.Value <> '') and (form12.DBRadioGroup8.Value <> '') and (form12.DBRadioGroup9.Value <> '') then
form12.DBEdit1.Text := IntToStr(StrToInt(form12.DBRadioGroup4.Value)+ StrToInt(form12.DBRadioGroup1.Value) + StrToInt(form12.DBRadioGroup2.Value) + StrToInt(form12.DBRadioGroup3.Value) + StrToInt(form12.DBRadioGroup5.Value) + StrToInt(form12.DBRadioGroup6.Value)+ StrToInt(form12.DBRadioGroup7.Value) + StrToInt(form12.DBRadioGroup8.Value) + StrToInt(form12.DBRadioGroup9.Value));
//form12.DBEdit1.Text := form12.DBRadioGroup1.Value + form12.DBRadioGroup2.Value + form12.DBRadioGroup3.Value;
end;

procedure TForm12.DBRadioGroup5Change(Sender: TObject);
begin
if (form12.DBRadioGroup1.Value <> '') and (form12.DBRadioGroup2.Value <> '') and (form12.DBRadioGroup3.Value <> '') and (form12.DBRadioGroup4.Value <> '') and (form12.DBRadioGroup5.Value <> '') and (form12.DBRadioGroup6.Value <> '')and (form12.DBRadioGroup7.Value <> '') and (form12.DBRadioGroup8.Value <> '') and (form12.DBRadioGroup9.Value <> '') then
form12.DBEdit1.Text := IntToStr(StrToInt(form12.DBRadioGroup5.Value)+ StrToInt(form12.DBRadioGroup1.Value) + StrToInt(form12.DBRadioGroup2.Value) + StrToInt(form12.DBRadioGroup3.Value) + StrToInt(form12.DBRadioGroup4.Value) + StrToInt(form12.DBRadioGroup6.Value)+ StrToInt(form12.DBRadioGroup7.Value) + StrToInt(form12.DBRadioGroup8.Value) + StrToInt(form12.DBRadioGroup9.Value));
//form12.DBEdit1.Text := form12.DBRadioGroup1.Value + form12.DBRadioGroup2.Value + form12.DBRadioGroup3.Value;
end;

procedure TForm12.DBRadioGroup6Change(Sender: TObject);
begin
if (form12.DBRadioGroup1.Value <> '') and (form12.DBRadioGroup2.Value <> '') and (form12.DBRadioGroup3.Value <> '') and (form12.DBRadioGroup4.Value <> '') and (form12.DBRadioGroup5.Value <> '') and (form12.DBRadioGroup6.Value <> '')and (form12.DBRadioGroup7.Value <> '') and (form12.DBRadioGroup8.Value <> '') and (form12.DBRadioGroup9.Value <> '') then
form12.DBEdit1.Text := IntToStr(StrToInt(form12.DBRadioGroup6.Value)+ StrToInt(form12.DBRadioGroup1.Value) + StrToInt(form12.DBRadioGroup2.Value) + StrToInt(form12.DBRadioGroup3.Value) + StrToInt(form12.DBRadioGroup5.Value) + StrToInt(form12.DBRadioGroup4.Value)+ StrToInt(form12.DBRadioGroup7.Value) + StrToInt(form12.DBRadioGroup8.Value) + StrToInt(form12.DBRadioGroup9.Value));
//form12.DBEdit1.Text := form12.DBRadioGroup1.Value + form12.DBRadioGroup2.Value + form12.DBRadioGroup3.Value;
end;

procedure TForm12.DBRadioGroup7Change(Sender: TObject);
begin
if (form12.DBRadioGroup1.Value <> '') and (form12.DBRadioGroup2.Value <> '') and (form12.DBRadioGroup3.Value <> '') and (form12.DBRadioGroup4.Value <> '') and (form12.DBRadioGroup5.Value <> '') and (form12.DBRadioGroup6.Value <> '')and (form12.DBRadioGroup7.Value <> '') and (form12.DBRadioGroup8.Value <> '') and (form12.DBRadioGroup9.Value <> '') then
form12.DBEdit1.Text := IntToStr(StrToInt(form12.DBRadioGroup7.Value)+ StrToInt(form12.DBRadioGroup1.Value) + StrToInt(form12.DBRadioGroup2.Value) + StrToInt(form12.DBRadioGroup3.Value) + StrToInt(form12.DBRadioGroup5.Value) + StrToInt(form12.DBRadioGroup6.Value)+ StrToInt(form12.DBRadioGroup4.Value) + StrToInt(form12.DBRadioGroup8.Value) + StrToInt(form12.DBRadioGroup9.Value));
//form12.DBEdit1.Text := form12.DBRadioGroup1.Value + form12.DBRadioGroup2.Value + form12.DBRadioGroup3.Value;
end;

procedure TForm12.DBRadioGroup8Change(Sender: TObject);
begin
if (form12.DBRadioGroup1.Value <> '') and (form12.DBRadioGroup2.Value <> '') and (form12.DBRadioGroup3.Value <> '') and (form12.DBRadioGroup4.Value <> '') and (form12.DBRadioGroup5.Value <> '') and (form12.DBRadioGroup6.Value <> '')and (form12.DBRadioGroup7.Value <> '') and (form12.DBRadioGroup8.Value <> '') and (form12.DBRadioGroup9.Value <> '') then
form12.DBEdit1.Text := IntToStr(StrToInt(form12.DBRadioGroup8.Value)+ StrToInt(form12.DBRadioGroup1.Value) + StrToInt(form12.DBRadioGroup2.Value) + StrToInt(form12.DBRadioGroup3.Value) + StrToInt(form12.DBRadioGroup5.Value) + StrToInt(form12.DBRadioGroup6.Value)+ StrToInt(form12.DBRadioGroup7.Value) + StrToInt(form12.DBRadioGroup4.Value) + StrToInt(form12.DBRadioGroup9.Value));
//form12.DBEdit1.Text := form12.DBRadioGroup1.Value + form12.DBRadioGroup2.Value + form12.DBRadioGroup3.Value;
end;

procedure TForm12.DBRadioGroup9Change(Sender: TObject);
begin
if (form12.DBRadioGroup1.Value <> '') and (form12.DBRadioGroup2.Value <> '') and (form12.DBRadioGroup3.Value <> '') and (form12.DBRadioGroup4.Value <> '') and (form12.DBRadioGroup5.Value <> '') and (form12.DBRadioGroup6.Value <> '')and (form12.DBRadioGroup7.Value <> '') and (form12.DBRadioGroup8.Value <> '') and (form12.DBRadioGroup9.Value <> '') then
form12.DBEdit1.Text := IntToStr(StrToInt(form12.DBRadioGroup9.Value)+ StrToInt(form12.DBRadioGroup1.Value) + StrToInt(form12.DBRadioGroup2.Value) + StrToInt(form12.DBRadioGroup3.Value) + StrToInt(form12.DBRadioGroup5.Value) + StrToInt(form12.DBRadioGroup6.Value)+ StrToInt(form12.DBRadioGroup7.Value) + StrToInt(form12.DBRadioGroup8.Value) + StrToInt(form12.DBRadioGroup4.Value));
//form12.DBEdit1.Text := form12.DBRadioGroup1.Value + form12.DBRadioGroup2.Value + form12.DBRadioGroup3.Value;
end;

end.


Gracias por vuestra ayuda.

Volver arriba
Ver perfil del usuario Enviar mensaje privado
Responder al Tema
Mostrar mensajes anteriores:   
Ir a:  
Todas las horas están en GMT + 2 Horas
Panel de Control
No puede crear mensajes, No puede responder temas, No puede editar sus mensajes, No puede borrar sus mensajes, No puede votar en encuestas,