fork(1) download
  1. Public Class frmChapa
  2. Private Sub btCalcular_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btCalcular.Click
  3. 'declaro la cadena de caracteres
  4. Dim texto As String
  5.  
  6. 'declaro las variables de control
  7. Dim x As Integer
  8. Dim y As Integer
  9.  
  10. 'declaro variable que almacena cada caracter de la cadena
  11. Dim caracter As Char
  12.  
  13. 'variable que me va a ir contando cada vez que encuentre un caracter repetido
  14. Dim CaracterRepetido As Integer
  15.  
  16. 'le asigno a la variable texto los datos ingresados por el usuario en la caja de texto
  17. texto = Me.txtCalcular.Text
  18.  
  19. 'controlo si la caja de texto no esta vacia
  20. If Me.txtCalcular.Text.Length = 0 Then
  21. MessageBox.Show("Ingrese la cadena de caracteres", "Calcular", MessageBoxButtons.OK, MessageBoxIcon.Warning)
  22. Else
  23. 'Uso dos estructuras repetitivas para controlar, tomo el primer caracter y los controlo con todos los demas, luego paso
  24. 'al segundo y asi sucesivamente, al encontrar uno lo cuenta...
  25. CaracterRepetido = 0
  26. For x = 0 To texto.Length - 1
  27. caracter = texto.Chars(x)
  28. For y = 0 To texto.Length - 1
  29. If y <> x Then
  30. If caracter = texto.Chars(y) Then
  31. CaracterRepetido = CaracterRepetido + 1
  32. End If
  33. End If
  34. Next
  35. Next
  36. 'por ultimo si el contador es igual a 0 quiere decir que no encontro ninguna caracter repetido sino si encontro caracteres
  37. 'repetidos y manda el msj
  38. If CaracterRepetido <> 0 Then
  39. MessageBox.Show("Se encontraron caracteres repetidos", "Control de caracteres", MessageBoxButtons.OK, MessageBoxIcon.Information)
  40. Else
  41. MessageBox.Show("No se encontraron caracteres repetidos", "Control de caracteres", MessageBoxButtons.OK, MessageBoxIcon.Information)
  42. End If
  43. End If
  44. CaracterRepetido = 0
  45. End Sub
  46. End Class
  47.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Visual Basic.Net Compiler version 0.0.0.5914 (Mono 2.4.2 - r)
Copyright (C) 2004-2008 Rolf Bjarne Kvinge. All rights reserved.


/home/S6D7aC/prog.vb (2,113) : Error VBNC30451: Could not resolve the name 'btCalcular'
/home/S6D7aC/prog.vb (17,20) : Error VBNC30456: 'txtCalcular' is not a member of 'frmChapa'.
/home/S6D7aC/prog.vb (20,15) : Error VBNC30456: 'txtCalcular' is not a member of 'frmChapa'.
/home/S6D7aC/prog.vb (21,24) : Error VBNC30451: Could not resolve the name 'MessageBox'
/home/S6D7aC/prog.vb (39,28) : Error VBNC30451: Could not resolve the name 'MessageBox'
/home/S6D7aC/prog.vb (41,28) : Error VBNC30451: Could not resolve the name 'MessageBox'
There were 6 errors and 0 warnings.
Compilation took 00:00:00.9761690
stdout
Standard output is empty