Amigos, tengo un problema raro con este codigo
Código Delphi
[-]for v := 0 to CheckListBox1.Count - 1 do
if (dblookupcombobox5.KeyValue = NULL) or (checklistbox1.Checked[v] = false) then
begin
MessageDlg('Debe seleccionar todos los datos', mtWarning, [mbOk],0);
Abort;
end else
no funciona al seleccionar igual me dice que no esta seleccionado pero si lo coloco en True y selecciono funciona no se que ocurre
coloco codigo completo
Código Delphi
[-]procedure Tmainform.BitBtn19Click(Sender: TObject);
var
bItem: TListItem;
i,v: Integer;
temp: TStrings;
begin
for v := 0 to CheckListBox1.Count - 1 do
if (dblookupcombobox5.KeyValue = NULL) or (checklistbox1.Checked[v] = false) then
begin
MessageDlg('Debe seleccionar todos los datos', mtWarning, [mbOk],0);
Abort;
end else
temp := TStringList.Create;
try
for I := 0 to CheckListBox1.Items.Count - 1 do
begin
if CheckListBox1.Checked[i] then
begin
temp.add(CheckListBox1.Items.Strings[i]);
end;
end;
finally
showmessage(TStringsToString(temp));
begin
Zquery1.sql.text := 'insert into ent_htas values (:Fecha,:Trabajador,:Herramienta)';
ZQuery1.ParamByName('Fecha').AsDate := Datetimepicker4.Date;
ZQuery1.ParamByName('Trabajador').AsString := dblookupcombobox5.KeyValue;
ZQuery1.ParamByName('Herramienta').AsString := TStringsToString(temp);
ZQuery1.ExecSQL;
Zquery1.Close;
Zquery1.SQL.Text := 'SELECT * FROM ent_htas';
zquery1.Open;
Listview5.Clear;
temp.Free;
end;
while not zquery1.Eof do
begin
bItem := Listview5.Items.Add;
bItem.Caption := zQuery1.fieldbyname('Fecha').AsString;
bItem.SubItems.Add(zQuery1.fieldbyname('Trabajador').AsString);
bItem.SubItems.Add(zQuery1.fieldbyname('Herramienta').AsString);
zquery1.next;
end;
dblookupcombobox5.KeyValue := NULL;
for v := 0 to CheckListBox1.Count - 1 do
CheckListBox1.Checked[v] := False;
end;
end;
Saludos