Looks like a good start; finding the deltas for the X & Y coordinates.
double dblDistX = Math.Abs(pt1.X - pt2.X);
double dblDistY = Math.Abs(pt1.Y - pt2.Y);
Now I'm guessing that you want the diagonal distance (Z) between these 2 points. Time to break out the HS Geometry book and look up my buddy Pythagoreas and see what he has for theorems.
Pythagoreas wrote:
In a right angled triangle: the square of the hypotenuse is equal to the sum of the squares of the other two sides.
Update 02/14/2019
This is how it would be in
handwritten math:
z
2 = x
2 + y
2
z = √(x
2 + y
2)
My original answer included this code which was in no specific language. From the comments below I was informed that this would work for VB
double Z = (dblDistX^2 + dblDistY^2)^.5
C# is what the OP is using so here are 2 versions of it; the long long version and the 1 liner
double dblSqrdDistX = Math.Pow(dblDistX,2);
double dblSqrdDistY = Math.Pow(dblDistY,2);
double dblSqrdHypotenuseZ = dblSqrdDistX + dblSqrdDistY;
double Z = Math.Sqrt(dblSqrdHypotenuseZ);
double Z = Math.Sqrt(Math.Pow(dblDistX,2) + Math.Pow(dblDistY,2));