Ver Mensaje Individual
  #3  
Antiguo 25-02-2012
Avatar de Caral
[Caral] Caral is offline
Miembro Premium
 
Registrado: ago 2006
Posts: 7.659
Reputación: 27
Caral Va por buen camino
Hola
Sabiendo cuantos items hay y que valor tienen:
1- se recorre el combobox.
2- se define en la variable i cuantos items tiene.
3- se asigna valor.
4- se muestra en el label1.
En este caso 4 items, 4 valores.
Código Delphi [-]
procedure TForm1.ComboBox1Change(Sender: TObject);
var
  i  :Integer;
  valor : Real;
begin
    for i := 0 to ComboBox1.ItemIndex do begin
    case i of
     0 : begin
         valor:= 0.017;
          end;
     1 : begin
          valor:= 0.020;
          end;
     2 : begin
          valor:= 1.22;
          end;
     3 : begin
          valor:= 2.015;
          end;
end;
    Label1.Caption:= FloatToStr(valor);
end;
end;
Saludos
__________________
Siempre Novato

Última edición por Caral fecha: 25-02-2012 a las 22:29:11.
Responder Con Cita