Lab 6-Sistema Integrado
-
Upload
teffy-lavado-gomez -
Category
Documents
-
view
34 -
download
0
Transcript of Lab 6-Sistema Integrado
MG. LUIS BOY CHAVIL Página 1
UNIVERSIDAD NACIONAL DE TRUJILLO FACULTAD DE INGENIERÍA ESCUELA DE INGENERÍA DE SISTEMAS
LABORATORIO Nº 01 USO DE HERRAMIENTAS CASE EN VISUAL BASIC NET
PARA INTEGRAR LA BASE DE DATOS DE UNA BIBLIOTECA
1. DISEÑO DE LA BASE DE DATOS
a) Modelado de Datos
MG. LUIS BOY CHAVIL Página 2
b) Base de Datos en SQL Server
2. DISEÑO DEL MENÚ PRINCIPAL
3. IMPLEMENTACIÓN DEL MENÚ PRINCIPAL EN VISUAL BASIC .NET
3.1 Operaciones con Interfaz de Múltiples Documentos (MDI)
Cargar un nuevo proyecto denominado: WinAppBIBLIOTECA
Sobre el Formulario; colocar la propiedad IsMdiContainer en true
Arrastrar el Objeto al formulario y diseñar el Menú; tal como se indica en el cuadro anterior; de la siguiente manera:
MG. LUIS BOY CHAVIL Página 3
3.2 Implementación del Menú principal
4. AGREGANDO ORÍGENES DE DATOS
En el Menú Principal de Visual Basic, elija: o Datos Agregar nuevo origen de datos … o En el Asistente para la configuración de orígenes de datos: o Seleccione Base de datos y aplique el botón Siguiente o En la ventana Elegir la conexión de datos; aplique en el botón:
Nueva Conexión… (Entonces, veremos:)
MG. LUIS BOY CHAVIL Página 4
Coloque un punto en el combo: Nombre del Servidor y elija la base de datos: BIBLIOTECA; luego Click en Aceptar
En la siguiente ventana, haga click en el botón Siguiente y luego otra vez.
Finalmente:
Seleccione Tablas y click en Finalizar.
Ahora, elija: Datos Mostrar orígenes de datos …
Veremos entonces, la siguiente ventana:
Agregaremos 14 formularios nuevos; uno por cada una de las 14 opciones del Menú Principal; colocando a los formularios como MDI Hijo; de la siguiente manera:
o Proyecto Agregar Windows Form (14 veces) y colocaremos en cada uno:
MG. LUIS BOY CHAVIL Página 5
o Propiedad Name: frmLIBROS o Propiedad Name: frmAUTORES o Propiedad Name: frmCATEGORÍAS o Propiedad Name: frmEDITORIALES o Propiedad Name: frmUSUARIOS o Propiedad Name: frmCARNETS o Propiedad Name: frmPAGOS o Propiedad Name: frmPRESTAMOS o Propiedad Name: frmLECTURASALA o Propiedad Name: frmLECTURADOMICILIO o Propiedad Name: frmRESERVACIONES o Propiedad Name: frmPEDIDOS o Propiedad Name: frmGUIAS o Propiedad Name: frmFACTURAS
El título de cada formulario será ACTUALIZACIÓN DE …… (Tabla)
Arrastraremos cada tabla de los orígenes de datos a su correspondiente formulario; así:
5. CODIFICACIÓN DEL MENÚ PRINCIPAL EN VISUAL BASIC .NET Public Class MDIFormBIBLIOTECA Private Sub AutoresToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AutoresToolStripMenuItem.Click Dim objAutores As New frmAUTORES objAutores.MdiParent = Me objAutores.Show() End Sub Private Sub LibrosToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LibrosToolStripMenuItem.Click Dim objLibros As New frmLIBROS objLibros.MdiParent = Me objLibros.Show() End Sub Private Sub CategoríasToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CategoríasToolStripMenuItem.Click Dim objCategorias As New frmCATEGORIAS objCategorias.MdiParent = Me
MG. LUIS BOY CHAVIL Página 6
objCategorias.Show() End Sub Private Sub EditorialesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EditorialesToolStripMenuItem.Click Dim objEditoriales As New frmEDITORIALES objEditoriales.MdiParent = Me objEditoriales.Show() End Sub Private Sub UsuariosToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UsuariosToolStripMenuItem1.Click Dim objUsuarios As New frmUSUARIOS objUsuarios.MdiParent = Me objUsuarios.Show() End Sub Private Sub CarnetsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CarnetsToolStripMenuItem.Click Dim objCarnets As New frmCARNETS objCarnets.MdiParent = Me objCarnets.Show() End Sub Private Sub PagosToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PagosToolStripMenuItem.Click Dim objPagos As New frmPAGOS objPagos.MdiParent = Me objPagos.Show() End Sub Private Sub PréstamosToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PréstamosToolStripMenuItem.Click Dim objPrestamos As New frmPRESTAMOS objPrestamos.MdiParent = Me objPrestamos.Show() End Sub Private Sub LecturaEnSalaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LecturaEnSalaToolStripMenuItem.Click Dim objLecturaEnSala As New frmLECTURASALA objLecturaEnSala.MdiParent = Me objLecturaEnSala.Show() End Sub Private Sub LecturaADomicilioToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LecturaADomicilioToolStripMenuItem.Click Dim objLecturaADomicilio As New frmLECTURADOMICILIO objLecturaADomicilio.MdiParent = Me objLecturaADomicilio.Show() End Sub
MG. LUIS BOY CHAVIL Página 7
Private Sub ReservasToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReservasToolStripMenuItem.Click Dim objReservas As New frmRESERVACIONES objReservas.MdiParent = Me objReservas.Show() End Sub Private Sub PedidosToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PedidosToolStripMenuItem.Click Dim objPedidos As New frmPEDIDOS objPedidos.MdiParent = Me objPedidos.Show() End Sub Private Sub GuíasToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GuíasToolStripMenuItem.Click Dim objGuías As New frmGUÍAS objGuías.MdiParent = Me objGuías.Show() End Sub Private Sub FacturasToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FacturasToolStripMenuItem.Click Dim objFacturas As New frmFACTURAS objFacturas.MdiParent = Me objFacturas.Show() End Sub End Class
6. IMPLEMENTACIÓN DEL MENÚ CONTEXTUAL
Un Menú Contextual, es un menú que aparece flotante al dar clic derecho sobre un objeto; para ello, seguiremos los siguientes pasos:
Arrastrar el objeto ContextMenuStrip hacia el formulario
Diseñe las siguientes opciones:
MG. LUIS BOY CHAVIL Página 8
Seleccione como objeto de activación el formulario frmBIBLIOTECA y configure la propiedad ContextMenuStrip con el valor ContextMenuStrip1.
7. CODIFICACIÓN DE LAS OPCIONES DEL MENÚ CONTEXTUAL Private Sub CascadaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CascadaToolStripMenuItem.Click Me.LayoutMdi(0) End Sub Private Sub HorizontalToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HorizontalToolStripMenuItem.Click Me.LayoutMdi(1) End Sub Private Sub VerticalToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VerticalToolStripMenuItem.Click Me.LayoutMdi(2) End Sub Private Sub AlineaVentanasToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AlineaVentanasToolStripMenuItem.Click Me.LayoutMdi(3) End Sub
8. FORMULARIO CON MENÚ CONTEXTUAL
MG. LUIS BOY CHAVIL Página 9
9. OPCIONES DEL MENÚ EN VERTICAL
10. CREACIÓN DE BARRAS DE HERRAMIENTAS
Arrastrar el control ToolBar hacia el formulario
Agregar un control ImageList
Configurar la propiedad Image, con una lista de imágenes; así:
Ahora, veamos las propiedades de ToolBar1: Objeto Propiedad Valor
ToolBar1 ImageList ImageList1 Buttons Colección … Asociar cada ImageIndex …
MG. LUIS BOY CHAVIL Página 10
Finalmente, tendremos: