First establish all the forces action on the object.
Fy = forces acting on y component
Fx = forces acting on x component
Fy = 0: and so, T*cos(theta) - m*g = 0 (T = tension of thread, m=mass, g=gravity)
Fx = 0: and so, T*sin(theta) - E*q = 0 (E=electric field, q=charge)
Combine the 2 equations by dividing Fx by Fy, resulting in:
tan(theta) = (E*q) / (m*g)
now solve for E.
E = tan(theta)*(m*g) / q
The formula for potential difference V, is:
V = E*d
so substitute E from above into this equation and you get that:
V = (tan(theta)*(m*g*d)) / q