Вы находитесь на странице: 1из 11

Public Class momo

Inherits System.Windows.Forms.Form

#Region " Cdigo generado por el Diseador de Windows Forms "

Public Sub New()
MyBase.New()

'El Diseador de Windows Forms requiere esta llamada.
InitializeComponent()

'Agregar cualquier inicializacin despus de la llamada a
InitializeComponent()

End Sub

'Form reemplaza a Dispose para limpiar la lista de componentes.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Requerido por el Diseador de Windows Forms
Private components As System.ComponentModel.IContainer

'NOTA: el Diseador de Windows Forms requiere el siguiente procedimiento
'Puede modificarse utilizando el Diseador de Windows Forms.
'No lo modifique con el editor de cdigo.
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
Friend WithEvents TextBox5 As System.Windows.Forms.TextBox
Friend WithEvents TextBox6 As System.Windows.Forms.TextBox
Friend WithEvents TextBox7 As System.Windows.Forms.TextBox
Friend WithEvents btnJugar As System.Windows.Forms.Button
Friend WithEvents lblletras As System.Windows.Forms.Label
Friend WithEvents Timer1 As System.Windows.Forms.Timer
Friend WithEvents Timer2 As System.Windows.Forms.Timer
Friend WithEvents rbnavanzado As System.Windows.Forms.RadioButton
Friend WithEvents rbnintermedio As System.Windows.Forms.RadioButton
Friend WithEvents rbnbasico As System.Windows.Forms.RadioButton
Friend WithEvents btnListo As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Me.Label1 = New System.Windows.Forms.Label
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.btnListo = New System.Windows.Forms.Button
Me.TextBox7 = New System.Windows.Forms.TextBox
Me.TextBox6 = New System.Windows.Forms.TextBox
Me.TextBox5 = New System.Windows.Forms.TextBox
Me.TextBox4 = New System.Windows.Forms.TextBox
Me.TextBox3 = New System.Windows.Forms.TextBox
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.lblletras = New System.Windows.Forms.Label
Me.GroupBox2 = New System.Windows.Forms.GroupBox
Me.rbnavanzado = New System.Windows.Forms.RadioButton
Me.rbnintermedio = New System.Windows.Forms.RadioButton
Me.rbnbasico = New System.Windows.Forms.RadioButton
Me.btnJugar = New System.Windows.Forms.Button
Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
Me.Timer2 = New System.Windows.Forms.Timer(Me.components)
Me.GroupBox1.SuspendLayout()
Me.GroupBox2.SuspendLayout()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 18.0!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.Location = New System.Drawing.Point(200, 8)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(220, 31)
Me.Label1.TabIndex = 0
Me.Label1.Text = "Juego de Memoria"
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.btnListo)
Me.GroupBox1.Controls.Add(Me.TextBox7)
Me.GroupBox1.Controls.Add(Me.TextBox6)
Me.GroupBox1.Controls.Add(Me.TextBox5)
Me.GroupBox1.Controls.Add(Me.TextBox4)
Me.GroupBox1.Controls.Add(Me.TextBox3)
Me.GroupBox1.Controls.Add(Me.TextBox2)
Me.GroupBox1.Controls.Add(Me.TextBox1)
Me.GroupBox1.Controls.Add(Me.lblletras)
Me.GroupBox1.Location = New System.Drawing.Point(24, 40)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(560, 112)
Me.GroupBox1.TabIndex = 1
Me.GroupBox1.TabStop = False
'
'btnListo
'
Me.btnListo.Location = New System.Drawing.Point(504, 40)
Me.btnListo.Name = "btnListo"
Me.btnListo.Size = New System.Drawing.Size(48, 48)
Me.btnListo.TabIndex = 11
Me.btnListo.Text = "Listo"
'
'TextBox7
'
Me.TextBox7.BackColor = System.Drawing.Color.White
Me.TextBox7.Font = New System.Drawing.Font("Microsoft Sans Serif", 18.0!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TextBox7.Location = New System.Drawing.Point(440, 40)
Me.TextBox7.MaxLength = 1
Me.TextBox7.Multiline = True
Me.TextBox7.Name = "TextBox7"
Me.TextBox7.ReadOnly = True
Me.TextBox7.Size = New System.Drawing.Size(56, 48)
Me.TextBox7.TabIndex = 10
Me.TextBox7.Text = ""
Me.TextBox7.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'TextBox6
'
Me.TextBox6.BackColor = System.Drawing.Color.White
Me.TextBox6.Font = New System.Drawing.Font("Microsoft Sans Serif", 18.0!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TextBox6.Location = New System.Drawing.Point(376, 40)
Me.TextBox6.MaxLength = 1
Me.TextBox6.Multiline = True
Me.TextBox6.Name = "TextBox6"
Me.TextBox6.ReadOnly = True
Me.TextBox6.Size = New System.Drawing.Size(56, 48)
Me.TextBox6.TabIndex = 9
Me.TextBox6.Text = ""
Me.TextBox6.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'TextBox5
'
Me.TextBox5.BackColor = System.Drawing.Color.White
Me.TextBox5.Font = New System.Drawing.Font("Microsoft Sans Serif", 18.0!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TextBox5.Location = New System.Drawing.Point(304, 40)
Me.TextBox5.MaxLength = 1
Me.TextBox5.Multiline = True
Me.TextBox5.Name = "TextBox5"
Me.TextBox5.ReadOnly = True
Me.TextBox5.Size = New System.Drawing.Size(64, 48)
Me.TextBox5.TabIndex = 8
Me.TextBox5.Text = ""
Me.TextBox5.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'TextBox4
'
Me.TextBox4.BackColor = System.Drawing.Color.White
Me.TextBox4.Font = New System.Drawing.Font("Microsoft Sans Serif", 18.0!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TextBox4.Location = New System.Drawing.Point(240, 40)
Me.TextBox4.MaxLength = 1
Me.TextBox4.Multiline = True
Me.TextBox4.Name = "TextBox4"
Me.TextBox4.ReadOnly = True
Me.TextBox4.Size = New System.Drawing.Size(56, 48)
Me.TextBox4.TabIndex = 7
Me.TextBox4.Text = ""
Me.TextBox4.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'TextBox3
'
Me.TextBox3.BackColor = System.Drawing.Color.White
Me.TextBox3.Font = New System.Drawing.Font("Microsoft Sans Serif", 18.0!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TextBox3.Location = New System.Drawing.Point(168, 40)
Me.TextBox3.MaxLength = 1
Me.TextBox3.Multiline = True
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.ReadOnly = True
Me.TextBox3.Size = New System.Drawing.Size(64, 48)
Me.TextBox3.TabIndex = 6
Me.TextBox3.Text = ""
Me.TextBox3.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'TextBox2
'
Me.TextBox2.BackColor = System.Drawing.Color.White
Me.TextBox2.Font = New System.Drawing.Font("Microsoft Sans Serif", 18.0!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TextBox2.Location = New System.Drawing.Point(96, 40)
Me.TextBox2.MaxLength = 1
Me.TextBox2.Multiline = True
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.ReadOnly = True
Me.TextBox2.Size = New System.Drawing.Size(64, 48)
Me.TextBox2.TabIndex = 5
Me.TextBox2.Text = ""
Me.TextBox2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'TextBox1
'
Me.TextBox1.BackColor = System.Drawing.Color.White
Me.TextBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 18.0!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TextBox1.Location = New System.Drawing.Point(16, 40)
Me.TextBox1.MaxLength = 1
Me.TextBox1.Multiline = True
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.ReadOnly = True
Me.TextBox1.Size = New System.Drawing.Size(72, 48)
Me.TextBox1.TabIndex = 4
Me.TextBox1.Text = ""
Me.TextBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'lblletras
'
Me.lblletras.AutoSize = True
Me.lblletras.Location = New System.Drawing.Point(16, 16)
Me.lblletras.Name = "lblletras"
Me.lblletras.Size = New System.Drawing.Size(0, 16)
Me.lblletras.TabIndex = 0
'
'GroupBox2
'
Me.GroupBox2.Controls.Add(Me.rbnavanzado)
Me.GroupBox2.Controls.Add(Me.rbnintermedio)
Me.GroupBox2.Controls.Add(Me.rbnbasico)
Me.GroupBox2.Location = New System.Drawing.Point(24, 160)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(160, 88)
Me.GroupBox2.TabIndex = 2
Me.GroupBox2.TabStop = False
Me.GroupBox2.Text = "Nivel"
'
'rbnavanzado
'
Me.rbnavanzado.Location = New System.Drawing.Point(16, 64)
Me.rbnavanzado.Name = "rbnavanzado"
Me.rbnavanzado.Size = New System.Drawing.Size(104, 16)
Me.rbnavanzado.TabIndex = 3
Me.rbnavanzado.Text = "Avanzado"
'
'rbnintermedio
'
Me.rbnintermedio.Location = New System.Drawing.Point(16, 40)
Me.rbnintermedio.Name = "rbnintermedio"
Me.rbnintermedio.Size = New System.Drawing.Size(112, 16)
Me.rbnintermedio.TabIndex = 2
Me.rbnintermedio.Text = "Intermedio"
'
'rbnbasico
'
Me.rbnbasico.Location = New System.Drawing.Point(16, 16)
Me.rbnbasico.Name = "rbnbasico"
Me.rbnbasico.Size = New System.Drawing.Size(96, 16)
Me.rbnbasico.TabIndex = 0
Me.rbnbasico.Text = "Bsico"
'
'btnJugar
'
Me.btnJugar.Enabled = False
Me.btnJugar.Location = New System.Drawing.Point(200, 168)
Me.btnJugar.Name = "btnJugar"
Me.btnJugar.Size = New System.Drawing.Size(72, 32)
Me.btnJugar.TabIndex = 1
Me.btnJugar.Text = "Jugar"
'
'Timer1
'
'
'Timer2
'
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(600, 277)
Me.Controls.Add(Me.btnJugar)
Me.Controls.Add(Me.GroupBox2)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.Label1)
Me.Name = "Form1"
Me.Text = "Juego de Memoria ** Pds - Soft"
Me.GroupBox1.ResumeLayout(False)
Me.GroupBox2.ResumeLayout(False)
Me.ResumeLayout(False)

End Sub

#End Region
Dim a, b As Short
Dim cont As Short
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles rbnbasico.CheckedChanged
cont = 3
btnJugar.Enabled = True
TextBox4.Visible = False
TextBox5.Visible = False
TextBox6.Visible = False
TextBox7.Visible = False
lblletras.Text = ""
btnJugar.Focus()
fin()

End Sub

Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles rbnintermedio.CheckedChanged
cont = 5
fin()
lblletras.Text = ""
btnJugar.Enabled = True
TextBox4.Visible = True
TextBox5.Visible = True
TextBox6.Visible = False
TextBox7.Visible = False
End Sub

Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles rbnavanzado.CheckedChanged
cont = 7
fin()
lblletras.Text = ""
btnJugar.Enabled = True
TextBox4.Visible = True
TextBox5.Visible = True
TextBox6.Visible = True
TextBox7.Visible = True
End Sub

Private Sub btnJugar_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnJugar.Click
Dim i, y As Short
Dim x As System.Random
x = New System.Random
For i = 1 To cont
y = x.Next(97, 101)
lblletras.Text = lblletras.Text & Chr(y)
Next
TextBox1.Text = "" : TextBox1.ReadOnly = False
TextBox2.Text = "" : TextBox2.ReadOnly = False
TextBox3.Text = "" : TextBox3.ReadOnly = False
TextBox4.Text = "" : TextBox4.ReadOnly = False
TextBox5.Text = "" : TextBox5.ReadOnly = False
TextBox6.Text = "" : TextBox6.ReadOnly = False
TextBox7.Text = "" : TextBox7.ReadOnly = False
Timer1.Enabled = True
Timer2.Enabled = True
lblletras.Visible = True
btnJugar.Enabled = False
btnListo.Enabled = True
TextBox1.Focus()
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
a = 0
b = 0
cont = 0
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
a = a + 10
If rbnbasico.Checked = True Then
If a = 7000 Then
MessageBox.Show("Te demorastes mucho, intenta de nuevo")
fin()
Timer1.Enabled = False
a = 0
b = 0
cont = 0
btnJugar.Enabled = False
End If
End If
If rbnintermedio.Checked = True Then
If a = 10000 Then
MessageBox.Show("Te demorastes mucho, intenta de nuevo")
fin()
Timer1.Enabled = False
a = 0
b = 0
cont = 0
btnJugar.Enabled = False
End If
End If
If rbnavanzado.Checked = True Then
If a = 15000 Then
MessageBox.Show("Te demorastes mucho, intenta de nuevo")
fin()
Timer1.Enabled = False
a = 0
b = 0
cont = 0
btnJugar.Enabled = False
End If
End If
End Sub
Private Sub fin()

'btnJugar.Enabled = False
TextBox1.Text = "" : TextBox1.ReadOnly = True
TextBox2.Text = "" : TextBox2.ReadOnly = True
TextBox3.Text = "" : TextBox3.ReadOnly = True
TextBox4.Text = "" : TextBox4.ReadOnly = True
TextBox5.Text = "" : TextBox5.ReadOnly = True
TextBox6.Text = "" : TextBox6.ReadOnly = True
TextBox7.Text = "" : TextBox7.ReadOnly = True
' lblletras.Text = ""

End Sub

Private Sub TextBox1_LostFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles TextBox1.LostFocus
TextBox1.Text = TextBox1.Text.ToUpper
End Sub

Private Sub TextBox2_LostFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles TextBox2.LostFocus
TextBox2.Text = TextBox2.Text.ToUpper
End Sub

Private Sub TextBox3_LostFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles TextBox3.LostFocus
TextBox3.Text = TextBox3.Text.ToUpper
End Sub

Private Sub TextBox4_LostFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles TextBox4.LostFocus
If cont = 5 Or cont = 7 Then
TextBox4.Text = TextBox4.Text.ToUpper
End If
End Sub

Private Sub TextBox5_LostFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles TextBox5.LostFocus
If cont = 5 Or cont = 7 Then
TextBox5.Text = TextBox5.Text.ToUpper
End If

End Sub

Private Sub TextBox6_LostFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles TextBox6.LostFocus
If cont = 7 Then
TextBox6.Text = TextBox6.Text.ToUpper
End If

End Sub

Private Sub TextBox7_LostFocus(ByVal sender As Object, ByVal e As
System.EventArgs) Handles TextBox7.LostFocus
If cont = 7 Then
TextBox7.Text = TextBox7.Text.ToUpper
End If

End Sub

Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer2.Tick
b = b + 10
If rbnbasico.Checked = True Then
If b = 2000 Then
lblletras.Visible = False
End If
End If
If rbnintermedio.Checked = True Then
If b = 4000 Then
lblletras.Visible = False
End If
End If
If rbnavanzado.Checked = True Then
If b = 8000 Then
lblletras.Visible = False
End If
End If
End Sub

Private Sub btnListo_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnListo.Click
Dim z As String
z = Trim(TextBox1.Text.ToUpper) & Trim(TextBox2.Text.ToUpper) &
Trim(TextBox3.Text.ToUpper) & Trim(TextBox4.Text.ToUpper) &
Trim(TextBox5.Text.ToUpper) & Trim(TextBox6.Text.ToUpper) &
Trim(TextBox7.Text.ToUpper)
If Trim(lblletras.Text.ToUpper) = z Then
lblletras.Visible = True

MessageBox.Show("Ganastes")
Else
MessageBox.Show("Que poco seso tienes")
lblletras.Visible = True
lblletras.Text = ""

End If
Timer1.Enabled = False
Timer2.Enabled = False
btnJugar.Enabled = False
btnListo.Enabled = False
rbnbasico.Checked = False
rbnintermedio.Checked = False
rbnavanzado.Checked = False
a = 0
b = 0
cont = 0
End Sub
End Class

Tttttttttttttttttttttttttttttt
Private Sub rbnbasico_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles rbn_a.CheckedChanged
btn_jugar.Enabled = True
TextBox1.Enabled = False
TextBox1.Enabled = True
TextBox1.Enabled = False
TextBox1.Enabled = True
TextBox1.Enabled = True
End Sub

Private Sub rbnintermedio_CheckedChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles rbn_e.CheckedChanged
btn_jugar.Enabled = True
TextBox1.Enabled = False
TextBox1.Enabled = False
TextBox1.Enabled = True
TextBox1.Enabled = False
TextBox1.Enabled = True
End Sub

Private Sub rbnavanzado_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles rbn_i.CheckedChanged, rbn_u.CheckedChanged,
rbn_o.CheckedChanged
btn_jugar.Enabled = True
TextBox1.Enabled = False
TextBox1.Enabled = False
TextBox1.Enabled = False
TextBox1.Enabled = False
TextBox1.Enabled = False
End Sub

If InStr(1, "a,e,i,o,u^" & Chr(8), e.KeyChar) = 0 Then
e.KeyChar = ""
End If



Cccccccccccccccccccccccccccccccccccc
Puedes poner TextBox2.Focus en el eventos Shown del form
Private Sub Form1_Shown(sender As Object, e As System.EventArgs)
Handles Me.Shown
TextBox2.Focus()
End Sub
Y si quieres que pierda el enfoque el textbox2 y no puedan ingresar texto hasta que una
condicion no lo permita, puedes desabilitar el control
TextBox2.enabled=False ' deshabilitado
TextBox2.enabled=True' habilitar
o
TextBox2.ReadOnly = False ' permite escritura
TextBox2.ReadOnly = True ' no permite escritura
o
por que no pones
If tecla = 27 Then ' Tecla Esc pulsada
Cursor.Show()
textbox1.focus()
End If

Вам также может понравиться