You are on page 1of 3

Public Class Form1

Dim usu, pass As String

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

pass = TextBox2.Text
usu = TextBox1.Text
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


usu = TextBox1.Text
pass = TextBox2.Text
If usu = "Eliana" And pass = "anairda1525" Then
Form2.Show()
MsgBox("Bienvenido usuario")
Else
If usu = "José" And pass = "auacjos" Then
Form2.Show()
MsgBox("Bienvenido individuo")
Else
MsgBox("Falla el usuario o contraseña estan erroneos")
End If
End If
End Sub
End Class

ic Class Form2
Dim a, u, c, jos As Integer

Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load


Label1.Visible = False
Label2.Visible = False
Label4.Visible = False
Label5.Visible = False

End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim arreglo(8) As Integer
arreglo(0) = TextBox1.Text
arreglo(1) = TextBox2.Text
arreglo(2) = TextBox3.Text
arreglo(3) = TextBox4.Text
arreglo(4) = TextBox5.Text
arreglo(5) = TextBox6.Text
arreglo(6) = TextBox7.Text
arreglo(7) = TextBox8.Text
arreglo(8) = TextBox9.Text

jos = arreglo(1) + arreglo(2) + arreglo(3) + arreglo(4) + arreglo(5) + arreglo(6) + arreglo(7) + arreglo(8) + arreglo(0)

If TextBox1.Text > 9 Or TextBox2.Text > 9 Or TextBox3.Text > 9 Or TextBox4.Text > 9 Or TextBox5.Text > 9 Or
TextBox6.Text > 9 Or TextBox7.Text > 9 Or TextBox8.Text > 9 Or TextBox9.Text > 9 Then
MsgBox("Falla no se pueden ingresar números mayores al 9")
ElseIf jos = 45 Then

a = arreglo(0) + arreglo(1) + arreglo(2) + arreglo(3)


u = arreglo(6) + arreglo(7) + arreglo(8) + arreglo(3)
c = arreglo(0) + arreglo(4) + arreglo(5) + arreglo(6)
Label1.Text = a
Label2.Text = u
Label4.Text = c

If a = u And a = c And u = c Then


Label5.Text = (a + u + c) / 3
Label5.Visible = True
Label4.Visible = True
Label2.Visible = True
Label1.Visible = True
MsgBox("Muy bien ☺")

ElseIf a <> u Or a <> c Or u <> c Then

MsgBox("LAMENTABLEMENTE ESTAS HACIENDO ALGUNA ACCIÓN MAL")

Label4.Visible = True
Label2.Visible = True
Label1.Visible = True

End If
ElseIf jos <> 45 Then

You might also like