¿y por qué en vez de usar change no usas keypress? y cuando terminas de ingresar el precio si presionan enter te muestre el mensaje
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menúprivate void button1_Click(object sender, EventArgs e)
{
string text = this.textBox1.Text;
int[] array = new int[11];
int i = 0;
this.rear(array);
if (text.Length > 6 && text.Length < 12)
{
while (i < text.Length)
{
array[i] = this.Asc(text[i].ToString());
i++;
}
this.arr(ref array, array.Length);
int num = this.sum(array, 10);
if (num > 1245 & num < 1250)
{
if (array[0] + array[1] > 125 && array[0] + array[1] < 150)
{
if (array[3] == array[5])
{
this.label2.ForeColor = Color.Green;
this.label2.Text = "CORRECTO :)";
}
else
{
this.label2.ForeColor = Color.Red;
this.label2.Text = "INCORRECTO";
}
}
else
{
this.label2.ForeColor = Color.Red;
this.label2.Text = "INCORRECTO";
}
}
else
{
this.label2.ForeColor = Color.Red;
this.label2.Text = "INCORRECTO";
}
}
else
{
this.label2.ForeColor = Color.Red;
this.label2.Text = "INCORRECTO";
}
}
public int sum(int[] v, int cant)
{
int result;
if (cant > -1)
{
result = v[cant] + this.sum(v, cant - 1);
}
else
{
result = 0;
}
return result;
}
public void rear(int[] clav)
{
for (int i = 0; i < clav.Length; i++)
{
clav[i] = 0;
}
}
public void arr(ref int[] clav, int cant)
{
if (cant > 1)
{
for (int i = 0; i < cant - 1; i++)
{
if (clav[i] > clav[i + 1])
{
int num = clav[i];
clav[i] = clav[i + 1];
clav[i + 1] = num;
}
}
this.arr(ref clav, cant - 1);
}
}
Public Function NunAText(ByVal value As Double) As String
Select Case value
Case 0 : NunAText = "CERO"
Case 1 : NunAText = "UN"
Case 2 : NunAText = "DOS"
Case 3 : NunAText = "TRES"
Case 4 : NunAText = "CUATRO"
Case 5 : NunAText = "CINCO"
Case 6 : NunAText = "SEIS"
Case 7 : NunAText = "SIETE"
Case 8 : NunAText = "OCHO"
Case 9 : NunAText = "NUEVE"
Case 10 : NunAText = "DIEZ"
Case 11 : NunAText = "ONCE"
Case 12 : NunAText = "DOCE"
Case 13 : NunAText = "TRECE"
Case 14 : NunAText = "CATORCE"
Case 15 : NunAText = "QUINCE"
Case Is < 20 : NunAText = "DIECI" & NunAText(value - 10)
Case 20 : NunAText = "VEINTE"
Case Is < 30 : NunAText = "VEINTI" & NunAText(value - 20)
Case 30 : NunAText = "TREINTA"
Case 40 : NunAText = "CUARENTA"
Case 50 : NunAText = "CINCUENTA"
Case 60 : NunAText = "SESENTA"
Case 70 : NunAText = "SETENTA"
Case 80 : NunAText = "OCHENTA"
Case 90 : NunAText = "NOVENTA"
Case Is < 100 : NunAText = NunAText(Int(value \ 10) * 10) & " Y " & NunAText(value Mod 10)
Case 100 : NunAText = "CIEN"
Case Is < 200 : NunAText = "CIENTO " & NunAText(value - 100)
Case 200, 300, 400, 600, 800 : NunAText = NunAText(Int(value \ 100)) & "CIENTOS"
Case 500 : NunAText = "QUINIENTOS"
Case 700 : NunAText = "SETECIENTOS"
Case 900 : NunAText = "NOVECIENTOS"
Case Is < 1000 : NunAText = NunAText(Int(value \ 100) * 100) & " " & NunAText(value Mod 100)
Case 1000 : NunAText = "MIL"
Case Is < 2000 : NunAText = "MIL " & NunAText(value Mod 1000)
Case Is < 1000000 : NunAText = NunAText(Int(value \ 1000)) & " MIL"
If value Mod 1000 Then NunAText = NunAText & " " & NunAText(value Mod 1000)
Case 1000000 : NunAText = "UN MILLON"
Case Is < 2000000 : NunAText = "UN MILLON " & NunAText(value Mod 1000000)
Case Is < 1000000000000.0# : NunAText = NunAText(Int(value / 1000000)) & " MILLONES "
If (value - Int(value / 1000000) * 1000000) Then NunAText = NunAText & " " & NunAText(value - Int(value / 1000000) * 1000000)
'Case 1000000000000.0# : NunAText = "UN BILLON"
'Case Is < 2000000000000.0# : NunAText = "UN BILLON " & NunAText(value - Int(value / 1000000000000.0#) * 1000000000000.0#)
'Case Else : NunAText = NunAText(Int(value / 1000000000000.0#)) & " BILLONES"
' If (value - Int(value / 1000000000000.0#) * 1000000000000.0#) Then NunAText = NunAText & " " & NunAText(value - Int(value / 1000000000000.0#) * 1000000000000.0#)
End Select
End Function