cuando dimensiono los arreglos dentro del button3 no me da problemas y compila bien, pero cuando intento definir sus valores fuera del button para hacer que las variables sean globales me da error, es al definir sus valores. Necesito que sean globales porque debo usarlas desde otro form y no se a que se debe este error.
Public Class Form2
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.Hide()
Form1.Show()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
txtUsuario.Clear()
txtContrasena.Clear()
End Sub
Dim registro(4, 1) As String
registro(0, 0) = "gerente"
registro(0, 1) = "123"
registro(1, 0) = "oficinista"
registro(1, 1) = "1234"
registro(2, 0) = "recepcionista"
registro(2, 1) = "12345"
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim encontrada As Boolean = False
Dim usuarioIntroducido As String = txtUsuario.Text
Dim contrasenaIntroducida As String = txtContrasena.Text
Dim verificador As Boolean
For i As Integer = 0 To 2
If usuarioIntroducido = registro(i, 0) And contrasenaIntroducida = registro(i, 1) Then
encontrada = True
ElseIf usuarioIntroducido = registro(i, 0) And contrasenaIntroducida <> registro(i, 1) Then
verificador = True
End If
Next
If encontrada = True Then
Me.Hide()
Form3.Show()
ElseIf usuarioIntroducido = "" And contrasenaIntroducida = "" Then
MsgBox("Por favor ingrese usuario y contraseña")
ElseIf verificador = True Then
MsgBox("Contraseña incorrecta")
Else
MsgBox("Usuario incorrecto")
End If
End Sub
Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles txtContrasena.TextChanged
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs)
End Sub
End Class
Public
en lugar deDim
Public Static