Saludos!
Tengo el siguiente Keygen que genera varias claves..
Ire por fila y nombramientos
Text Box 1: Donde la persona pondra su Nombre.
Text box 2: Donde saldra el Key
Check Box 1: Donde marcara si es la version vieja [Key 16 digitos]
Check box 2: Donde marcara si es la version moderna [Key 20 digitos]
Botton 1: El boton de generar
Este es mi codigo:
Public Class Form1
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub CheckedListBox44_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub iCT_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub INGENUITY_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub CheckBox6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox6.CheckedChanged
End Sub
Private Sub CheckBox5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox5.CheckedChanged
End Sub
Private Sub CheckBox4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox4.CheckedChanged
End Sub
Private Sub CheckBox9_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox9.CheckedChanged
End Sub
Private Sub CheckBox8_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox8.CheckedChanged
End Sub
Private Sub CheckBox7_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox7.CheckedChanged
End Sub
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox2.Text = Int(Rnd() * 5)
Select Case TextBox2.Text
Case 0
TextBox2.Text = "71587E67012990840EC0913F7EB17FDCEC2A43BF3523014C0432BF44075435FC"
Case 1
TextBox2.Text = "CC227E5F012990BE4E476CC2834C8223C1C7BE42C8DEFCFA21DC52A9FB69C7BD"
Case 2
TextBox2.Text = "43C67E5D012990BEAAC807A9E827E94A7ABCD529A3B597DA92A429D291C2A36A"
Case 3
TextBox2.Text = "5DA27BED012990BEC6D6759B9A5D9EC808CEA75BD1C7E5A8E0DE5BA0E3B0D118"
Case 4
TextBox2.Text = "7AF7BF290122547A93FA07E9E82FECBA7ABCD529A3B597DA92AC29D291C2A36A"
End Select
End Sub
Private Sub CheckBox1_CheckedChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
Handles CheckBox1.CheckedChanged
If CheckBox1.Checked Then
TextBox1.Enabled = True
Else
TextBox1.Enabled = False
End If
End Sub
Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
Handles CheckBox2.CheckedChanged
If CheckBox2.Checked Then
TextBox1.Enabled = True
Else
TextBox1.Enabled = False
End If
End Sub
End Class
Mis problemas...
1- No se como hacer que sea obligatorio escribir algo en mi Text box 1 para asi te permita presionar el Botton 1.
2- Cuando trato de compilar este codigo:
Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
Handles CheckBox2.CheckedChanged
If CheckBox2.Checked Then
TextBox1.Enabled = True
Else
TextBox1.Enabled = False
End If
End Sub
Es para que el Text box este oculto y sea obligatorio seleccionar uno de los CheckBox para habilitarlo. Al ejectuarlo me da error de Sintax en el area de: "Handles"; Me lo podrian explicar?
3- Se como hacer que salga un Key en un rand.. pero no se como hacer para que cuando yo seleccione el CheckBox 1 solo se active el rand de las Key de 16 y si selecciono el CheckBox 2 solo se active el rand de las key de 20.
Saludos!
Ignoren la pregunta dos.. Observe que escribi lo mismo.. DOS VECES.. xD...
Ya me funciona el Handles.
Sigo con las otras preguntas. [1 y 3 ]
Ya logre la pregunta numero 3.. solo falta la 1 y termino mi Keygen xDD
1: Depende de la complejidad de la comprobación que quieras, puedes implementar un
ErrorProvider (http://msdn.microsoft.com/en-us/library/system.windows.forms.errorprovider%28v=vs.110%29.aspx) y definir las reglas, o puedes hacer algo mucho más básico como esto:
Private Sub Form1_Shown(sender As Object, e As EventArgs) _
Handles MyBase.Shown
button1.enabled = false
End Sub
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) _
Handles TextBox1.TextChanged
button1.enabled = String.IsNullOrEmpty(CStr(sender.text))
End Sub
EDITO:Cita de: LukaCrosszeria en 23 Marzo 2014, 02:38 AM
2- Cuando trato de compilar este codigo:
...
Al ejectuarlo me da error de Sintax en el area de: "Handles"; Me lo podrian explicar?
Es porque has publicado la clausula handles y la has colocado dentro del Sub, es imposible que eso compile.
Si tu intención era añadir más handles debes separarlos por una coma:
Handles Evento1, Evento2.
Si tu intención era romper la linea para añadir el Handles en una nueva linea entonces arriba tienes 2 ejemplos de como hacerlo.
EDITO 2:Cita de: LukaCrosszeria en 23 Marzo 2014, 02:38 AM
no se como hacer para que cuando yo seleccione el CheckBox 1 solo se active el rand de las Key de 16 y si selecciono el CheckBox 2 solo se active el rand de las key de 20.
Una manera de especificar la longitud sería asi:
private KeyLength as integer = -1I
Private Sub Form1_Shown(sender As Object, e As EventArgs) _
Handles MyBase.Shown
CheckBox1.tag = 16I
CheckBox2.tag = 20I
End Sub
Private Sub CheckBox_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) _
Handles CheckBox1.CheckedChanged, CheckBox2.CheckedChanged
KeyLength = CInt(sender.tag)
End Sub
private sub GenerarRandomKey()
Select case KeyLength
Case Is 16I
Case Is 20I
End Select
End sub
Saludos