amp-web-push-widget button.amp-subscribe { display: inline-flex; align-items: center; border-radius: 5px; border: 0; box-sizing: border-box; margin: 0; padding: 10px 15px; cursor: pointer; outline: none; font-size: 15px; font-weight: 500; background: #4A90E2; margin-top: 7px; color: white; box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.5); -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } .amp-logo amp-img{width:190px} .amp-menu input{display:none;}.amp-menu li.menu-item-has-children ul{display:none;}.amp-menu li{position:relative;display:block;}.amp-menu > li a{display:block;} /* Inline styles */ span.acsseb086{display:inline-block;overflow:hidden;max-width:0px;}div.acss138d7{clear:both;}div.acssf5b84{--relposth-columns:3;--relposth-columns_m:2;--relposth-columns_t:2;}div.acssa8a3d{aspect-ratio:1/1;background:transparent no-repeat scroll 0% 0%;height:300px;max-width:300px;}div.acss13836{color:#333333;font-family:Arial;font-size:14px;height:75px;}span.acss47fcd{background:#FFFFFF;color:#000000;}div.acss0f1bf{display:none;}a.acssf23c5{font-size:8pt;}a.acss24ea4{font-size:16.4pt;}a.acss066f0{font-size:22pt;} .ampforwp_wc_shortcode{margin-top: 0;padding:0;display:inline-block;width: 100%;} .ampforwp_wc_shortcode li{position: relative;width:29%; font-size:12px; line-height: 1; float: left;list-style-type: none;margin:2%;} .ampforwp_wc_shortcode .onsale{position: absolute;top: 0;right: 0;background: #ddd;padding: 7px;font-size: 12px;} .single-post .ampforwp_wc_shortcode li amp-img{margin:0} .ampforwp-wc-title{margin: 8px 0px 10px 0px;font-size: 13px;} .ampforwp-wc-price{color:#444} .wc_widgettitle{text-align:center;margin-bottom: 0px;} .ampforwp-wc-price, .ampforwp_wc_star_rating{float:left;margin-right: 10px;} .icon-widgets:before {content: "\e1bd";}.icon-search:before {content: "\e8b6";}.icon-shopping-cart:after {content: "\e8cc";} /******* Paste your Custom CSS in this Editor *******/

Parte 10 – Validación Form Datos Empresa y Creacion del Form Perfil de Usuario

En este vídeo se hace la validación del formulario de Datos de la Empresa y se crear el formulario de Perfil de Usuario para editar los datos de usuario es decir: El usuario puede entrar a esta ventana para editar sus datos y  para el cambio de contraseña.

El botón guardar lleva el siguiente código:

Private Sub cmdGuardar_Click()
    If txtNombreEmpresa.Text = "" Then
       MsgBox "Debe llenar el Campo Nombre Empresa", vbExclamation, "Error"
       txtNombreEmpresa.SetFocus
       Exit Sub
    End If
    If txtPropietario.Text = "" Then
       MsgBox "Debe llenar el Campo Propietario", vbExclamation, "Error"
       txtPropietario.SetFocus
       Exit Sub
    End If
    If txtNit.Text = "" Then
       MsgBox "Debe llenar el Campo Nit", vbExclamation, "Error"
       txtNit.SetFocus
       Exit Sub
    End If
    If txtTelefono.Text = "" Then
       MsgBox "Debe llenar el Campo Telefono", vbExclamation, "Error"
       txtTelefono.SetFocus
       Exit Sub
    End If
    If txtDireccion.Text = "" Then
       MsgBox "Debe llenar el Campo Dirección", vbExclamation, "Error"
       txtDireccion.SetFocus
       Exit Sub
    End If
    If txtDescripcion.Text = "" Then
       MsgBox "Debe llenar el Campo Descripción", vbExclamation, "Error"
       txtDescripcion.SetFocus
       Exit Sub
    End If
    
    If cmdTipoRegimen.ListIndex = 1 Then
        If txtResolucion.Text = "" Then
           MsgBox "Debe llenar el Campo Resolución", vbExclamation, "Error"
           txtResolucion.SetFocus
           Exit Sub
        End If
        If IsDate(txtFechaApro.Text) = False Then
           MsgBox "Escriba una Fecha de Aprovación válida", vbExclamation, "Error"
           txtFechaApro.SetFocus
           Exit Sub
        End If
        If txtRango1.Text = "" Then
           MsgBox "Debe llenar el Campo Rango 1", vbExclamation, "Error"
           txtRango1.SetFocus
           Exit Sub
        End If
        If txtRango2.Text = "" Then
           MsgBox "Debe llenar el Campo Rango 2", vbExclamation, "Error"
           txtRango2.SetFocus
           Exit Sub
        End If
        If txtFacturarDesde.Text = "" Then
           MsgBox "Debe llenar el Campo Facturar Desde", vbExclamation, "Error"
           txtFacturarDesde.SetFocus
           Exit Sub
        End If
    
    End If
   
   Call GuardarDatos
   
   Call DesabilitarControles
End Sub

Para validar y que el campo solo reciba números se utiliza la siguiente función:

Function SoloNumeros(Key_p) As Boolean
    If Key_p = 13 Or Key_p = 8 Or Key_p = 46 Or Key_p = 44 Then
       SoloNumeros = True
       Exit Function
    End If
    If Key_p >= 48 And Key_p <= 57 Then
        SoloNumeros = True
    Else
        SoloNumeros = False
    End If
End Function

Validación del campo Rango 1

Private Sub txtRango1_GotFocus()
   Call DeseleccionarTexBox(Me)
   Call SeleccionarTextBox(txtRango1)
End Sub

Private Sub txtRango1_KeyPress(KeyAscii As Integer)
    If SoloNumeros(KeyAscii) = False Then
       KeyAscii = 0
    End If
End Sub

Private Sub txtRango1_KeyUp(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
          txtRango2.SetFocus
    End If
End Sub

Validación del campo Rango 2

Private Sub txtRango2_GotFocus()
   Call DeseleccionarTexBox(Me)
   Call SeleccionarTextBox(txtRango2)
End Sub

Private Sub txtRango2_KeyPress(KeyAscii As Integer)
    If SoloNumeros(KeyAscii) = False Then
       KeyAscii = 0
    End If
End Sub

Private Sub txtRango2_KeyUp(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
       txtFacturarDesde.SetFocus
    End If
End Sub

Procedimiento para guardar los datos:

Sub GuardarDatos()
    
    'Valdaciones
    Dim Regimen As Integer
    Dim FechaR As Date
    Regimen = Me.cmdTipoRegimen.ListIndex
    If Me.txtFechaApro.Text <> "" Then
       FechaR = Me.txtFechaApro.Text
    End If
    Call GuardarDatosEmpresa(txtNombreEmpresa, txtPropietario.Text, txtNit, txtTelefono, txtDireccion, txtLogo, txtDescripcion, Regimen, txtResolucion, FechaR, txtRango1, txtRango2, txtFacturarDesde)
    
End Sub

Actualización del procedimiento LlenarDatos:

Sub LlenarDatos()
    Dim RecorsetTemp  As New ADODB.RecordSet
    Dim Sql As String
    
    Sql = "Select * from tblDatosEmpresa where IdEmpresa =  1"
    RecorsetTemp.Open Sql, ConexionADO
    
    If RecorsetTemp.RecordCount > 0 Then
       
        txtNombreEmpresa.Text = RecorsetTemp("NombreEmpresa")
        txtPropietario.Text = RecorsetTemp("Propietario")
        txtNit.Text = RecorsetTemp("Nit")
        txtTelefono.Text = RecorsetTemp("Telefonos")
        txtDireccion.Text = RecorsetTemp("Direccion")
        
        txtLogo.Text = RecorsetTemp("Logo")
        If Dir(txtLogo.Text) <> "" And txtLogo.Text <> "" Then
           imgLogo.Picture = LoadPicture(txtLogo.Text)
        Else
           imgLogo.Picture = LoadPicture(App.Path & "\logo.jpg")
        End If
        
        txtDescripcion.Text = RecorsetTemp("Descripcion")
        cmdTipoRegimen.ListIndex = RecorsetTemp("Regimen")
        txtResolucion.Text = RecorsetTemp("Resolucion")
        txtFechaApro.Text = RecorsetTemp("FechaResol")
        txtRango1.Text = RecorsetTemp("Rango1")
        txtRango2.Text = RecorsetTemp("Rango2")
        txtFacturarDesde.Text = RecorsetTemp("IniciarEn")
    
    End If
    
    
End Sub

Evento Clic del Campo Regimen:

Private Sub cmdTipoRegimen_Click()
    If cmdTipoRegimen.ListIndex = 0 Then
        txtResolucion.Enabled = False
        txtFechaApro.Enabled = False
        txtRango1.Enabled = False
        txtRango2.Enabled = False
        txtFacturarDesde.Enabled = False
        txtResolucion.Text = "0"
        txtRango1.Text = "0"
        txtRango2.Text = "0"
        txtFacturarDesde.Text = "0"
        txtFechaApro.Mask = ""
        txtFechaApro.Text = ""
    Else
        If cmdTipoRegimen.Enabled = True Then
            txtResolucion.Enabled = True
            txtFechaApro.Enabled = True
            txtRango1.Enabled = True
            txtRango2.Enabled = True
            txtFacturarDesde.Enabled = True
            txtFechaApro.Mask = "##/##/####"
        End If
    End If
End Sub

 

 

En este vídeo explico detalladamente como elaborar la ventana y su validación.

Siguiente Lección Parte 11 Ventana de Perfil de Usuario

Total Page Visits: 6628 - Today Page Visits: 1
Leave a Comment
Compartir
Publicado por

Publicaciones Recientes

CRUD Enviar y Recibir datos de Visual Basic 6 a PHP

Saludos, en este tutorial aprenderás a integrar tu aplicación de Visual Basic 6 con un…

4 meses hace

Problemas para acceder a Hotmail o Live.com desde el navegador web

Recientemente, muchos usuarios de Hotmail (ahora Outlook.com) han reportado un error al intentar iniciar sesión…

6 meses hace

Calculadora Básica en Visual Basic 6, Aprende a usar variables

En este proyecto, vamos a desarrollar una calculadora sencilla usando Visual Basic 6, que permite…

1 año hace

Lenguajes de Programación Más Demandados en 2024

6 de septiembre de 2024 - La demanda de desarrolladores de software sigue en aumento,…

1 año hace

La Unión Europea Aprueba la Primera Ley de Inteligencia Artificial del Mundo

En un movimiento histórico, la Unión Europea ha aprobado la primera ley de inteligencia artificial…

1 año hace

Sincronización de Datos en Línea VB6: Lleva tu Proyecto al Siguiente Nivel

¿Sigues trabajando con Visual Basic 6 y necesitas una forma eficiente de acceder a tus…

1 año hace

Este sitio utiliza cookies desea activarlas