Visula
EVENTOS PARA REALIZAR ACCESO DE ENTRADA
Private Sub cmdAceptar_Click() If (TxtUsuario.Text = "1234") Then Form2.Show Unload Me MsgBox ("Bienvenido a Kazak Multimedia Player"), vbInformation, "Mensaje" Else MsgBox ("Por favor inserte la contraseña correcta"), vbCritical, "¡Error!" TxtUsuario = "" TxtUsuario.SetFocus End If End Sub
Kazak_anjes Software
Página1
Eventos en Visual Basic 6.0
CALCULADORA
Public Suma As Double
Private Sub Command1_Click() Dim Valor As Double If Text1.Text = "" Then Valor = 0 Else Valor = CDbl(Text1.Text) End If Suma = Suma + Valor LblResultado.Caption = Suma Text1.Text = "" End Sub
Private Sub mnumerica_Click() L.Show Kazak_anjes Software Página 2
Eventos en Visual Basic 6.0
End Sub
Private SubOptDividir_Click() If Val(TxtSegundoValor.Text) = 0 Then MsgBox ("No se puede dividir por cero.") Else TxtResultado.Text = Val(TxtPrimerValor.Text) / Val(TxtSegundoValor.Text) End If End Sub
Private Sub OptMultiplicar_Click() TxtResultado.Text = Val(TxtPrimerValor.Text) * Val(TxtSegundoValor.Text) End Sub
Private Sub OptRestar_Click() TxtResultado.Text = Val(TxtPrimerValor.Text) -Val(TxtSegundoValor.Text) End Sub
Private Sub OptSumar_Click() TxtResultado.Text = Val(TxtPrimerValor.Text) + Val(TxtSegundoValor.Text) End Sub
Private Sub TxtPrimerValor_KeyPress(KeyAscii As Integer) If InStr("0123456789" & Chr(8) & Chr(13), Chr(KeyAscii)) = 0 Then KeyAscii = 0 End If End Sub
Kazak_anjes Software
Página 3
Eventos en Visual Basic 6.0
Private SubTxtSegundoValor_KeyPress(KeyAscii As Integer) If InStr("0123456789" & Chr(8) & Chr(13), Chr(KeyAscii)) = 0 Then KeyAscii = 0 End If End Sub
PARA HACER UN REGISTRO
Private Sub Command1_Click() Dim Clave As String Clave = "1234512345123451234512345" 'Verifica que la contraseña es igual a la que contiene las cajas. If TxtCaja1.Text & TxtCaja2.Text & TxtCaja3.Text & TxtCaja4.Text & TxtCaja5.Text = Clave Then MsgBox("Contraseña Correcta.") Unload Me ' Cierra esta ventana. Else MsgBox ("Contraseña Incorrecta."), vbCritical, "Registro" TxtCaja1.SetFocus ' Hace que la primera caja reciba el enfoque. End If End Sub
Private Sub Command2_Click() End End Sub Kazak_anjes Software Página 4
Eventos en Visual Basic 6.0
Private Sub TxtCaja1_Change() 'Verificamos que Si la primera caja de texto tiene cinco caracteres. IfLen(TxtCaja1.Text) = 5 Then TxtCaja2.SetFocus ' Saltamos a la segunda caja. End If End Sub
Private Sub TxtCaja2_Change() 'Verificamos que Si la primera caja de texto tiene cinco caracteres. If Len(TxtCaja2.Text) = 5 Then TxtCaja3.SetFocus ' Saltamos a la tercera caja. End If End Sub
Private Sub TxtCaja3_Change() 'Verificamos que Si la primera caja de texto tiene cinco caracteres. IfLen(TxtCaja3.Text) = 5 Then TxtCaja4.SetFocus ' Saltamos a la cuarta caja. End If End Sub
Private Sub TxtCaja4_Change() 'Verificamos que Si la primera caja de texto tiene cinco caracteres. If Len(TxtCaja4.Text) = 5 Then TxtCaja5.SetFocus ' Saltamos a la quinta caja. End If End Sub Kazak_anjes Software Página 5
Eventos en Visual Basic 6.0
Private Sub TxtCaja5_Change() 'Verificamos que Si la cuartacaja de texto tiene cinco caracteres. 'If Len(TxtCaja5.Text) = 5 Then 'cmdRegistrar.SetFocus 'Hacemos que el botón Registrar reciba el enfoque. 'End If End Sub
CAMBIO DE COLORES EN LOS LABELS
Option Explicit Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long Dim MoveCursor As Boolean Private SubCommand1_Click()
End Sub
Kazak_anjes Software
Página 6
Eventos en Visual Basic 6.0
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) ' Desactiva el color de fondo de las opciones 'If Label3.BackStyle = 1 Then Label3.BackStyle = 0 'If Label4.BackStyle = 1 Then Label4.BackStyle = 0 'If Label5.BackStyle = 1 Then Label5.BackStyle = 0 'If Label6.BackStyle...
Regístrate para leer el documento completo.