Solved

Posted on 2003-02-18
Medium Priority
420 Views
Hi,

i want to increment the IP Address by constant value
e.g

10.10.0.47 + 1 = 10.10.0.48

my approach to say that:
while Edit1.Text < Edit2.Text do
begin
Host := Edit1.Text + 1;
end;
0
Question by:aelabed
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 3

Expert Comment

ID: 7980223
you can divide the number into 4 parts

W.X.Y.Z

W:=10;
X:=10;
Y:=0;
Z:=47;

then you can add to the number you want any value you want

Edit1.Text := StrToInt(W)+'.'+StrToInt(X)+'.'+StrToInt(Y)+'.'+StrToInt(Z);

0

Expert Comment

ID: 7980542
This way the ip is increased as far as possible :)

W:=10;
X:=10;
Y:=0;
Z:=47;

if Z < 256 then inc(Z)
else if Y < 256 then inc(Y)
else if X < 256 then inc(X)
else if W < 256 then inc(W);

Edit1.Text := StrToInt(W)+'.'+StrToInt(X)+'.'+StrToInt(Y)+'.'+StrToInt(Z);
0

LVL 5

Expert Comment

ID: 7988647
it should be "< 255", isn't it?
0

Expert Comment

ID: 7995921
true 255 is the highest possible, so all less then 256 are possible.

or it should be "<= 255"
0

Author Comment

ID: 7998329
ok, thanx, but first i should to declare w,x,y,z as integer public variables, then i should return tha value to zero after 255 in x,y,z while w < 255 , as follows:

if Z < 255 then inc(Z)
else if Y < 255 then begin inc(Y); Z := 0; end
else if X < 255 then begin inc(X); Y := 0; end
else if W < 255 then begin inc(W); X := 0 end;

Edit1.Text := IntToStr(W)+'.'+IntToStr(X)+'.'+IntToStr(Y)+'.'+IntToStr(Z);

but can I write the IP without points , means i need a text box as that for tha IP address in the tcp/ip properties in the control panel.
0

LVL 3

Expert Comment

ID: 8007288
you would need 4 editboxes with '.' between them
and set the values in them according to the
values in W,X,Y and Z
0

Expert Comment

ID: 9317192
aelabed:
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

LVL 10

Expert Comment

ID: 9927905
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:

Some days and here is the Christmas Time. I wish good luck and good health for you all and for your loved ones

kacor
EE Cleanup Volunteer
0

LVL 1

Accepted Solution

Computer101 earned 0 total points
ID: 9974890
PAQed, with points refunded (20)

Computer101
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
###### Suggested Courses
Course of the Month7 days, 20 hours left to enroll