Ver Mensaje Individual
  #6  
Antiguo 14-06-2011
Avatar de jejo1984
jejo1984 jejo1984 is offline
Miembro
NULL
 
Registrado: jun 2011
Posts: 39
Reputación: 0
jejo1984 Va por buen camino
Talking obtener id de un combobox delphi: tambien funca en lazarus

Código Delphi [-]
  while not SQLQuery2.EOF do
  begin
    cbox_tip_inci.Items.AddObject(SQLQuery2.Fields[1].AsString,TObject(SQLQuery2.Fields[0].AsInteger));
    SQLQuery2.Next;
  end;
Luego declaras una variable de tipo Integer asi:
Código Delphi [-]
Var idcombo: Integer;

Luego haces esto: usa el IntToStr para convertir la variable:
Código Delphi [-]
  if cbox_tip_inci.ItemIndex > -1 then
  begin
    idcombo:=Integer(cbox_tip_inci.Items.Objects[cbox_tip_inci.ItemIndex]);
    Label1.Caption:=IntToStr(idcombo);
  end;
Espero que sea de mucha ayuda soy un novato recien y quiero aprender más; así como ustedes =)
gracias

Última edición por ecfisa fecha: 14-06-2011 a las 20:57:42. Razón: Etiquetas [DELPHI] [/DELPHI]
Responder Con Cita