In a right triangle, the sum of the angles is always 180 degrees, and one of the angles is 90 degrees. Therefore, if \( A \) and \( B \) are the two non-right angles of the triangle, we can use the following equation:
\[ A + B + 90 = 180 \]
This simplifies to:
\[ A + B = 90 \]
Now substitute the expressions for \( A \) and \( B \):
\[ (2x + 51) + (7x - 15) = 90 \]
Combine like terms:
\[ 2x + 51 + 7x - 15 = 90 \] \[ (2x + 7x) + (51 - 15) = 90 \] \[ 9x + 36 = 90 \]
Now, isolate \( x \) by first subtracting 36 from both sides:
\[ 9x = 90 - 36 \] \[ 9x = 54 \]
Now, divide by 9:
\[ x = \frac{54}{9} \] \[ x = 6 \]
Thus, the value of \( x \) is \( \boxed{6} \).