Podrias hacer algo asi:
static double equation(double tiempo, double longitud, double Frecuencia)
{
if (tiempo==0.0)
return 4 * longitud / Frecuencia;
else if (longitud == 0.0)
return tiempo * Frecuencia / 4;
else
return 4 * longitud / tiempo;
}
y al llamarla seria asi:
equation(0.0015, 0.0, 4000000.0);
para el ejemplo que pones, lo cual te regresaria: 1500.0.
Saludos!
edit: Esta es la parte del calculo, los textbox te toca ponerlos a ti xP.