Delphi - Is not valid value

   
Vista:

Is not valid value

Publicado por Joan Carles (9 intervenciones) el 18/03/2013 11:53:04
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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Is not valid value

Publicado por Joan Carles (9 intervenciones) el 19/03/2013 13:47:52
Hola a todos y gracias por vuestra ayuda, aquí dejo la solución que he aplicado:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
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.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar
Imágen de perfil de xve

Is not valid value

Publicado por xve (9 intervenciones) el 19/03/2013 13:56:28
Gracias por comentarlo Joan Carles...
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar