I would like to know a way in which the output of my project will appear in a textArea in WindowsForms. I need this because my system is a binary number converter, and I want you to print on the screen the calculation step by step. If there is another way, I accept suggestions!
Example method:
public int ConverterDeBinarioParaDecimal(String numeroBinario)
{
double resultado = 0;
int qtdDigitos = numeroBinario.Length;
Console.WriteLine("xxx = {0}", qtdDigitos);
for (int cont = 0; cont < qtdDigitos; cont++)
{
if (numeroBinario[cont] == '1')
{
resultado = resultado + Math.Pow(2, qtdDigitos - (cont + 1));
}
}
int resultadoConversao = Convert.ToInt32(resultado);
return resultadoConversao;
}