Lo de rojo es mi problemilla...aún si separo el copy del delete el error persiste... Gracias
Código Delphi
[-]
procedure TForm1.ComboBox1Change(Sender: TObject);
Var
s_1, s_2, s_3, s_4, cad, sub, Mascara, pu, cad : string;
i, incremento : integer;
potencia : array[0..7] of integer;
mask : array[0..7] of integer;
begin
potencia[1]:= 2;
potencia[2]:= 4;
potencia[3]:= 8;
potencia[4]:= 16;
potencia[5]:= 32;
potencia[6]:= 64;
potencia[7]:= 128;
mask[7]:= 254;
mask[6]:= 252;
mask[5]:= 248;
mask[4]:= 240;
mask[3]:= 224;
mask[2]:= 192;
mask[1]:= 128;
sub := form1.Combobox1.text;
Red.open;
while not Red.Eof do
begin
if sub = (Red.Fieldbyname('Subred').asstring) then
begin
Mascara := (Red.Fieldbyname('Mascara').asstring);
Break;
end;
Red.Next;
end;
Red.close;
i := 1;
while i <= 6 do
begin
if mask[i] = strtoint(Mascara) then
break;
inc(i);
end;
incremento := potencia[i + 1];
form1.ComboBox2.Clear;
form1.ComboBox3.clear;
cad:=form1.ComboBox1.Text;
s_1 :=copy(cad,1,(pos('.',cad))-1); delete(cad,1,(pos('.',cad)));
s_2 :=copy(cad,1,(pos('.',cad))-1); delete(cad,1,(pos('.',cad)));
s_3 :=copy(cad,1,(pos('.',cad))-1); delete(cad,1,(pos('.',cad)));
s_4 := cad;
if strtoint(_subred_4) = 0 then
begin
for i := 2 to (254) do
begin
ComboBox2.Items.Add(_subred_1 + '.' + _subred_2 + '.' + _subred_3 + '.' +inttostr(i));
ComboBox3.Items.Add(_subred_1 + '.' + _subred_2 + '.' + _subred_3 + '.' +inttostr(i));
end;
exit
end
else
begin
for i := strtoint(_subred_4)+ 1 to (strtoint(_subred_4) + (incremento - 1)) do
begin
ComboBox2.Items.Add(_subred_1 + '.' + _subred_2 + '.' + _subred_3 + '.' + inttostr(i));
ComboBox3.Items.Add(_subred_1 + '.' + _subred_2 + '.' + _subred_3 + '.' + inttostr(i));
end;
exit
end;
end.