Rattack: Following is some information relating to your problems with inverse cosine
using VB. I assume your problems are with the mathematics, not the code required to get data
from Text Boxes, format it, and put it into labels or other Text Boxes. For the latter type of
problems, I would post in the General Questions forum.

If possible, I would suggest using the Functions at the end of this post.

Visual Basic provides a minimum set of math functions. The documentation includes formulae
(See Derived Math Functions) for additional functions not intrinsic to VB. For the inverse
cosine, the following is suggested.

Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)

The final term is a contrived way of expressing Pi/2 radians or 90 degrees. I would never do it
that way. In all my VB Math programs, I define constants for commonly used values like Pi,
2*Pi, Pi/2, e, et cetera.

The above formula returns a value between zero and Pi (0 and 180 degrees), which is often not a
suitable range. Note that the inverse tangent function has a problem at Pi/2 (90 degrees), where
1-X^2 in the above formula results in a zero divisor.

If you really want to compute the inverse cosine of a particular value using VB, the above is the
only way I know of doing it.

In almost all of the mathematical applications I have done, there is a context which suggests
using some other approach.

For engineering problems, you usually are dealing with a right triangle. The cosine is the ratio of
one side to the hypotenuse, while the tangent is the ratio of the two shorter sides. You can almost
always use the inverse tangent instead of inverse cosine. In the VB Functions provided below,
Engineers usually refer to Y and X as Rise and Run, or Opposite and Adjacent sides.

For most mathematical problems, you are usually working with a Cartesian (XY) coordinate
system, and want to deal with angles in ranges like 0 to 360, -90 to +90, -180 to +180. The sine
and cosine are Y/R & X/R, respectively (R is distance from origin), while the tangent is Y/X. It
is generally easier to work with inverse tangent of (Y/X) than inverse cosine of (X/R). If you
work with inverse cosine, you do not have enough data from (X/R) to know the quadrant of the
angle.

In all my programs, I use my own Longitude Function which returns an angle between 0 and
2*Pi (0 to 360 degrees), and a Latitude Function which returns an angle between -Pi/2 and +Pi/2
(-90 to +90 degrees). Both Functions use two arguments: Y & X, which can be positive or
negative. My functions take care of the problems at 90 degrees internally.
Code:
. . . 
Public Const Dpi As Double = 6.28318530717959  '360 Degrees
Public Const Pie As Double = 3.14159265358979  '180
Public Const Hpi As Double = 1.5707963267949   ' 90
Public Const Qpi As Double = 0.785398163397448 ' 45
. . .

Public Function Longitude(Y As Double, X As Double) As Double

'Returns value in range 0 to Dpi (0 to 360 Degrees)
'Hpi = Pie/2 (90 Degrees)  Qpi = Pie/4 (45 Degrees)

Dim Angle As Double

If Abs(X) > Abs(Y) Then             'must avoid divide by zero
        Angle = Abs(Atn(Y / X))
    ElseIf Abs(X) < Abs(Y) Then
        Angle = Hpi - Abs(Atn(X / Y))
    ElseIf X = 0 Then
        Longitude =  0
        Exit Function
    Else
        Angle = Qpi
  End If

If Y < 0 Then 'Third or 4th quadrant.
        If X < 0 Then '- - Third quadrant.
                Longitude = Angle + Pie
            Else '- + Fourth quadrant
                Longitude = Dpi - Angle
          End If
    ElseIf X < 0 Then '+ - Second quadrant.
        Longitude = Pie - Angle
    Else '+ + First quadrant.
        Longitude = Angle
  End If

End Function

Public Function Latitude(Y As Double, X As Double) As Double

'Returns value in range -Hpi to +Hpi (-90 to +90 Degrees).
'Hpi = Pie/2 (90 Degrees)  Qpi = Pie/4 (45 Degrees).
'X assumed non negative and treated as such.
'Quadrant might be incorrect If X is negative.

Dim Angle As Double

If Abs(X) > Abs(Y) Then             'must avoid divide by zero
        Angle = Abs(Atn(Y / X))
    ElseIf Abs(X) < Abs(Y) Then
        Angle = Hpi - Abs(Atn(X / Y))
    ElseIf X = 0 Then
        Latitude = 0
        Exit Function
    Else
        Angle = Qpi
  End If
  
If Y < 0 Then
        Latitude = -Angle
    Else
        Latitude = Angle
  End If

End Function
I hope there are no typo's above, and apologize if there are. The VB Functions were copied and pasted from programs which worked for me. The odds are good that they are correct.