0% found this document useful (0 votes)
9 views13 pages

Informe de Programación I - IUTEPAL

This document contains code for a Visual Basic .NET application that allows users to add, modify, and view employee data stored in arrays. The application includes forms for inputting new employee data, searching for existing employee records, requesting modifications to records, and confirming deletions. Data validation is performed to ensure required fields are complete and in the proper format. Arrays store employee IDs, names, contact details, and other attributes collected on the forms.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views13 pages

Informe de Programación I - IUTEPAL

This document contains code for a Visual Basic .NET application that allows users to add, modify, and view employee data stored in arrays. The application includes forms for inputting new employee data, searching for existing employee records, requesting modifications to records, and confirming deletions. Data validation is performed to ensure required fields are complete and in the proper format. Arrays store employee IDs, names, contact details, and other attributes collected on the forms.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

INSTITUTO UNIVERSITARIO DE TECNOLOGIA JUAN PABLO PEREZ ALFONZO IUTEPAL DIVISION SAN CRISTOBAL

INFORME DE PROGRAMACION 1

Autor: Melo Marques, Fernando C.I. 14.179.223

Seccin: 4021

SAN CRISTOBAL, JUNIO 2012

Primer formulario, en el que se introducen los datos

Public Class Form1 Dim i As Integer = 0 Public vecid(100) As String Public vecci(100) As String Public veccedu(100) As Integer Public vecnom(100) As String Public vecdir(100) As String Public vectel1(100) As Integer Public vectel2(100) As Integer Public vecmail(100) As String Public vecdepa(100) As String Public veccargo(100) As String Dim vecfech(100) As Date Private Sub Form1_Load(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] [Link]() End Sub Private Sub nombre_KeyPress(ByVal sender As Object, ByVal e As [Link]) Handles [Link]

If (Asc([Link]) >= 65 And Asc([Link]) <= 90) Or Asc([Link]) >= 97 And Asc([Link]) <= 122 Or Asc([Link]) = [Link] Or (Asc([Link]) = [Link]) Then [Link] = False ' validar solo caracteres mayusculas y minusculas Else [Link] = True End If End Sub Private Sub cedula_KeyPress(ByVal sender As Object, ByVal e As [Link]) Handles [Link] If (Not [Link]([Link]) And [Link] <> [Link](8)) Then [Link] = True ' validar solo numeros y tecla backspace End If End Sub Private Sub listados_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] [Link]() ' mostrar formulario con listado Hide() End Sub Private Sub tel1_KeyPress(ByVal sender As Object, ByVal e As [Link]) Handles [Link] If (Not [Link]([Link]) And [Link] <> [Link](8)) Then [Link] = True ' validar solo numeros y tecla backspace End If End Sub Private Sub tel2_KeyPress(ByVal sender As Object, ByVal e As [Link]) Handles [Link] If (Not [Link]([Link]) And [Link] <> [Link](8)) Then [Link] = True ' validar solo numeros y tecla backspace End If End Sub Private Sub email_Leave(ByVal sender As Object, ByVal e As [Link]) Handles [Link] Try ' validar formato del email usando funcion integrada en .net Dim mail As New [Link]([Link]) Catch ex As Exception [Link]([Link]) [Link] = "" [Link]() End Try End Sub Private Sub agregar_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] Dim k As Integer = 0 ' Validar que todos los campos esten completos If ([Link] = "") Then

MsgBox("Debe colocar el ID del empleado", [Link]) [Link]() k = k + 1 End If If ([Link] = "") Then MsgBox("Debe seleccionar la nacionalidad del empleado", [Link]) [Link]() k = k + 1 End If If ([Link] = "") Then MsgBox("Debe colocar la cdula del empleado", [Link]) [Link]() k = k + 1 End If If ([Link] = "") Then MsgBox("Debe colocar el nombre del empleado", [Link]) [Link]() k = k + 1 End If If ([Link] = "") Then MsgBox("Debe colocar el telfono del empleado", [Link]) [Link]() k = k + 1 End If If ([Link] = "") Then MsgBox("Debe colocar el telfono del empleado", [Link]) [Link]() k = k + 1 End If If ([Link] = "") Then MsgBox("Debe colocar el email del empleado", [Link]) [Link]() k = k + 1 End If If k = 0 Then ' Para que solo llene los datos en los vectores si estan todos los campos llenos vecid(i) = [Link] ' llenar los vectores con los datos vecci(i) = [Link] veccedu(i) = [Link] vecnom(i) = [Link] vecdir(i) = [Link] vectel1(i) = [Link]

vectel2(i) = [Link] vecmail(i) = [Link] vecdepa(i) = [Link] veccargo(i) = [Link] vecfech(i) = [Link] i = i + 1 ' contador del indice de los vectores [Link] = "" ' limpiar campos para el proximo ingreso [Link] = "" [Link] = "" [Link] = "" [Link] = "" [Link] = "" [Link] = "" [Link] = "" [Link] = "" [Link] = "" [Link]() [Link] = i End If End Sub Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As [Link]) Handles [Link] If MsgBox("Seguro que desea terminar la aplicacin?", [Link], "Confirmar cierre") = [Link] Then End ' Confirmacion para cerrar programa Else [Link] = True End If End Sub End Class

Formulario para buscar los datos, modificar, agregar nuevos o eliminar alguno

Public Class Form2 Private Sub eliminar_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] If MsgBox("Seguro que desea eliminar datos?", [Link]) = [Link] Then [Link]() End If End Sub Private Sub agregar2_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] If MsgBox("Agregar otro registro?", [Link]) = [Link] Then [Link]() Hide() End If End Sub Private Sub modificar_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] If MsgBox("Seguro que desea modificar los datos?", [Link]) = [Link] Then [Link]() End If End Sub

Private Sub buscedula_KeyPress(ByVal sender As Object, ByVal e As [Link]) Handles [Link] If (Not [Link]([Link]) And [Link] <> [Link](8)) Then [Link] = True ' validar solo numeros y tecla backspace End If End Sub Private Sub Form2_FormClosing(ByVal sender As Object, ByVal e As [Link]) Handles [Link] If MsgBox("Seguro que desea terminar la aplicacin?", [Link], "Confirmar cierre") = [Link] Then End Else [Link] = True End If End Sub Private Sub buscar_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] Dim j As Integer = [Link] If [Link] = "" Then MsgBox("Introduzca una cdula a buscar", [Link]) [Link]() Else For i As Integer = 0 To [Link] If [Link] = [Link](i) Then [Link]() [Link](0, j).Value = [Link](i) [Link](1, j).Value = [Link](i) [Link](2, j).Value = [Link](i) End If [Link]() Next End If End Sub Private Sub Form2_Load(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] [Link]() End Sub Private Sub Button1_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] Dim ruta As String ' Guardar archivo con los datos de ID empleado, cedula y nombre Dim archivo As Long Dim g As Integer = [Link] [Link] = "Archivo de texto(*.txt)|*.txt" [Link]() ruta = [Link]() If ruta <> "" Then

archivo = FreeFile() FileOpen(archivo, ruta, [Link]) PrintLine(archivo, "ARCHIVO DE PRUEBA DE ESCRITURA, INCLUYE EL CONTENIDO DEL DATAGRIDVIEW1") PrintLine(archivo, " ") PrintLine(archivo, "ID Empleado Cdula Nombre") For k As Integer = 0 To g - 1 PrintLine(archivo, [Link](0, k).Value, "", [Link](1, k).Value, "", [Link](2, k).Value) Next FileClose(archivo) End If End Sub End Class

Formulario de peticin de datos a modificar

Public Class Form4 Private Sub aceptar_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] If [Link] = "" Then MsgBox("Introduzca una cdula a modificar", [Link]) [Link]() Else For i As Integer = 0 To [Link] If [Link] = [Link](i) Then [Link] = [Link](i) [Link] = [Link](i) [Link] = [Link](i) [Link] = [Link](i) [Link] = [Link](i) [Link] = final.Form1.vectel1(i) [Link] = final.Form1.vectel2(i) [Link] = [Link](i) [Link] = final.Form1.vectel1(i) [Link] = [Link](i) [Link] = [Link](i) [Link]()

End If Next [Link] = "" Hide() End If End Sub Private Sub cancelar_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] [Link] = "" Hide() End Sub Private Sub ced_KeyPress(ByVal sender As Object, ByVal e As [Link]) Handles [Link] If (Not [Link]([Link]) And [Link] <> [Link](8)) Then [Link] = True ' validar solo numeros y tecla backspace End If End Sub End Class

Formulario para introducir los datos a modificar

Public Class Form3 Private Sub Form3_Load(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] [Link]() End Sub Private Sub nombre_KeyPress(ByVal sender As Object, ByVal e As [Link]) Handles [Link] If (Asc([Link]) >= 65 And Asc([Link]) <= 90) Or Asc([Link]) >= 97 And Asc([Link]) <= 122 Or Asc([Link]) = [Link] Or (Asc([Link]) = [Link]) Then [Link] = False ' validar solo caracteres mayusculas y minusculas Else [Link] = True End If End Sub Private Sub cedula_KeyPress(ByVal sender As Object, ByVal e As [Link]) Handles [Link] If (Not [Link]([Link]) And [Link] <> [Link](8)) Then [Link] = True ' validar solo numeros y tecla backspace End If End Sub Private Sub listados_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] [Link]() ' mostrar formulario con listado Hide() End Sub Private Sub tel1_KeyPress(ByVal sender As Object, ByVal e As [Link]) Handles [Link] If (Not [Link]([Link]) And [Link] <> [Link](8)) Then [Link] = True ' validar solo numeros y tecla backspace End If End Sub Private Sub tel2_KeyPress(ByVal sender As Object, ByVal e As [Link]) Handles [Link] If (Not [Link]([Link]) And [Link] <> [Link](8)) Then [Link] = True ' validar solo numeros y tecla backspace End If End Sub Private Sub email_Leave(ByVal sender As Object, ByVal e As [Link]) Handles [Link] Try ' validar formato del email usando mtodo integrado en .net Dim mail As New [Link]([Link]) Catch ex As Exception [Link]([Link]) [Link] = "" [Link]()

End Try End Sub Private Sub agregar_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] Dim k As Integer = 0 Dim i As Integer ' Validar que todos los campos esten completos If ([Link] = "") Then MsgBox("Debe colocar el ID del empleado", [Link]) [Link]() k = k + 1 End If If ([Link] = "") Then MsgBox("Debe seleccionar la nacionalidad del empleado", [Link]) [Link]() k = k + 1 End If If ([Link] = "") Then MsgBox("Debe colocar la cdula del empleado", [Link]) [Link]() k = k + 1 End If If ([Link] = "") Then MsgBox("Debe colocar el nombre del empleado", [Link]) [Link]() k = k + 1 End If If ([Link] = "") Then MsgBox("Debe colocar el telfono del empleado", [Link]) [Link]() k = k + 1 End If If ([Link] = "") Then MsgBox("Debe colocar el telfono del empleado", [Link]) [Link]() k = k + 1 End If If ([Link] = "") Then MsgBox("Debe colocar el email del empleado", [Link]) [Link]() k = k + 1

End If If k = 0 Then ' Para que solo llene los datos en los vectores si estan todos los campos llenos For i = 0 To [Link] If [Link] = [Link](i) Then [Link](i) = [Link] ' llenar los vectores con los datos [Link](i) = [Link] [Link](i) = [Link] [Link](i) = [Link] [Link](i) = [Link] final.Form1.vectel1(i) = [Link] final.Form1.vectel2(i) = [Link] [Link](i) = [Link] [Link](i) = [Link] [Link](i) = [Link] MsgBox("Datos modificados correctamente", [Link]) Hide() End If Next End If End Sub Private Sub Form3_FormClosing(ByVal sender As Object, ByVal e As [Link]) Handles [Link] If MsgBox("Seguro que desea terminar la aplicacin?", [Link], "Confirmar cierre") = [Link] Then End ' Confirmacion para cerrar programa Else [Link] = True End If End Sub End Class

Formulario de eliminar registro

Public Class Form5 Private Sub ced_KeyPress(ByVal sender As Object, ByVal e As [Link]) Handles [Link] If (Not [Link]([Link]) And [Link] <> [Link](8)) Then [Link] = True ' validar solo numeros y tecla backspace End If End Sub Private Sub cancelar_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] [Link] = "" Hide() End Sub Private Sub aceptar_Click(ByVal sender As [Link], ByVal e As [Link]) Handles [Link] If [Link] = "" Then MsgBox("Introduzca una cdula a eliminar", [Link]) [Link]() Else If MsgBox("Confirma que desea eliminar el registro del empleado?", [Link]) = [Link] Then For i As Integer = 0 To [Link] - 1 If [Link] = [Link](i) Then [Link](i) = "" [Link](i) = "" [Link](i) = "0" [Link](i) = "" [Link](i) = "" final.Form1.vectel1(i) = "0" final.Form1.vectel2(i) = "0" [Link](i) = "" [Link](i) = "" [Link](i) = "" MsgBox("Datos eliminados correctamente", [Link]) Hide() [Link] = [Link] - 1 End If Next [Link] = "" Hide() End If End If End Sub End Class

You might also like