Está en la página 1de 15

Alexis Martnez Bruno

Grupo: 5102

Matricula: 090260154-1

Manual de programador

Alexis Martnez Bruno

Grupo: 5102

Matricula: 090260154-1

Como Conectar la base de datos


Imports System.Data.OleDb Public Class MenuUsuarios Dim fila As Integer = 0 Dim dt As New DataTable Dim cn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\Control Escolar.accdb")

Botn Acceso
Private Sub Access_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Access.Click Dim encontrado = 0 fila = 0 Do While (fila <= dt.Rows.Count - 1) If (TextContrasea.Text = dt.Rows(fila)("Password")) Then MsgBox(" Acceso Permitido " + Usuario.Text, MsgBoxStyle.Information, "Mensaje") encontrado = 1 Me.Hide() MenuPrincipal.Show() TextContrasea.Text = "" TextContrasea.Focus() End If fila = fila + 1 Loop If encontrado = 0 Then MsgBox(" Acceso Denegado ", MsgBoxStyle.Critical, "Mensaje") End If End Sub

Botn Salir
Private Sub Salir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Salir.Click If ((MsgBox(" Enserio Desea Abandonar Este Proyecto ?", MsgBoxStyle.OkCancel, "Mensaje")) = 1) Then Me.Close() End If End Sub

Alexis Martnez Bruno

Grupo: 5102

Matricula: 090260154-1

Men Alumnos
Private Sub MenuAlumnos_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuAlumno.Click Me.Hide() MenuAlumnos.Show() End Sub

Men Asignatura
Private Sub MenuAsignaturas_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuAsignaturas.Click Me.Hide() MenuAsignatura.Show() End Sub

Men Grupos
Private Sub MenuGrupos_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuGrupo.Click Me.Hide() MenuGrupos.Show() End Sub

Men Maestros
Private Sub MenuMaestros_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuMaestro.Click Me.Hide() MenuMaestros.Show() End Sub

Men Materias
Private Sub MenuMaterias_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuMateria.Click Me.Hide() MenuMaterias.Show() End Sub

Botn Regresar
Private Sub Regresar_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Regresar.Click If ((MsgBox(" Enserio Desea Regresar al Menu de Usuarios? ", MsgBoxStyle.OkCancel, "Mensaje")) = 1) Then MenuUsuarios.Show() Me.Close() End If End Sub

Alexis Martnez Bruno

Grupo: 5102

Matricula: 090260154-1

Men Alumnos Funciones:


Private Sub Refrescar() dt.Reset() fila = 0 Dim RefrescarDatos As String = "Select * From Alumnos" Dim dataAdapter As New OleDb.OleDbDataAdapter(RefrescarDatos, cn) dataAdapter.Fill(dt) Actualiza() dataAdapter.Dispose() End Sub Public Sub Actualiza() TextMatricula.Text = CStr(dt.Rows(fila)("Matricula")) TextNombre.Text = CStr(dt.Rows(fila)("Nombre")) TextPaterno.Text = CStr(dt.Rows(fila)("Paterno")) TextMaterno.Text = CStr(dt.Rows(fila)("Materno")) TextDireccion.Text = CStr(dt.Rows(fila)("Direccion")) TextNumgrupo.Text = CInt(dt.Rows(fila)("Numgrupo")) End Sub Private Sub Ver() Dim ver As String = "SELECT * FROM Alumnos" Dim dataAdapter As New OleDb.OleDbDataAdapter(ver, cn) dataAdapter.Fill(dt) TextMatricula.Text = CStr(dt.Rows(fila)("Matricula")) TextNombre.Text = CStr(dt.Rows(fila)("Nombre")) TextPaterno.Text = CStr(dt.Rows(fila)("Paterno")) TextMaterno.Text = CStr(dt.Rows(fila)("Materno")) TextDireccion.Text = CStr(dt.Rows(fila)("Direccion")) TextNumgrupo.Text = CInt(dt.Rows(fila)("Numgrupo")) dataAdapter.Dispose() End Sub

Botn Altas
Private Sub Guardar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Guardar.Click cn.Open() Dim GuardarDatos As String = " Insert Into Alumnos(Matricula,Nombre,Paterno,Materno,Direccion,Numgrupo)" & "Values('" & TextMatricula.Text & "','" & TextNombre.Text & "','" & TextPaterno.Text & "','" & TextMaterno.Text & "','" & TextDireccion.Text & "','" & TextNumgrupo.Text & "')" Dim dataAdapter As New OleDb.OleDbDataAdapter(GuardarDatos, cn) dataAdapter.Fill(dt) MsgBox("Se Agrego registro Correctamente", MsgBoxStyle.Information, "Mensaje") dataAdapter.Dispose() cn.Close() End Sub

Boton Bajas
Private Sub Bajas_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bajas.Click If ((MsgBox("... Desea Eliminar ? " + CStr(TextMatricula.Text), MsgBoxStyle.OkCancel, "Mensaje")) = 1) Then Dim Delete As String = "DELETE FROM Alumnos WHERE Matricula='" & CStr(TextMatricula.Text) & "';" Dim dataAdapter As New OleDb.OleDbDataAdapter(Delete, cn) dataAdapter.Fill(dt) Refrescar() Actualiza() dataAdapter.Dispose() Else MsgBox("No se ha seleccionado registro a eliminar") End If End Sub

Alexis Martnez Bruno

Grupo: 5102

Matricula: 090260154-1

Boton Consultas
Private Sub Consultar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Consultar.Click cn.Open() Dim strSQL As String = "Select * From Alumnos Where Matricula='" & CStr(TextMatricula.Text()) & "';" Dim dataAdapter As New OleDb.OleDbDataAdapter(strSQL, cn) dt.Reset() dataAdapter.Fill(dt) fila = 0 Actualiza() dataAdapter.Dispose() cn.Close() End Sub

Boton Modificaciones
Private Sub Modificar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Modificar.Click cn.Open() Dim ModificaDatos As String = "Update Alumnos Set Matricula= '" & TextMatricula.Text & "', Nombre = '" & TextNombre.Text & "' , Paterno ='" & TextPaterno.Text & "', Materno ='" & TextMaterno.Text & "', Direccion ='" & TextDireccion.Text & "', Numgrupo ='" & TextNumgrupo.Text & "' Where Matricula='" & Alumno & "';" Dim dataAdapter As New OleDb.OleDbDataAdapter(ModificaDatos, cn) dataAdapter.Fill(dt) dataAdapter.Dispose() MsgBox("Registro Modificado", MsgBoxStyle.Information, "Mensaje") cn.Close() End Sub

Boton Ver Registros


Private Sub Ver() Dim ver As String = "SELECT * FROM Alumnos" Dim dataAdapter As New OleDb.OleDbDataAdapter(ver, cn) dataAdapter.Fill(dt) TextMatricula.Text = CStr(dt.Rows(fila)("Matricula")) TextNombre.Text = CStr(dt.Rows(fila)("Nombre")) TextPaterno.Text = CStr(dt.Rows(fila)("Paterno")) TextMaterno.Text = CStr(dt.Rows(fila)("Materno")) TextDireccion.Text = CStr(dt.Rows(fila)("Direccion")) TextNumgrupo.Text = CInt(dt.Rows(fila)("Numgrupo")) dataAdapter.Dispose() End Sub Private Sub VerRegistros_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VerRegistros.Click Ver() End Sub

Boton Anterior
Private Sub Anterior_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Anterior.Click If (fila > 0 And fila <= dt.Rows.Count - 1) Then fila = fila - 1 Actualiza() Else MsgBox("Primer Registro Encontrado", MsgBoxStyle.Information, "Mensaje") End If End Sub

Boton Siguiente
Private Sub Siguiente_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Siguiente.Click If (fila >= 0 And fila < dt.Rows.Count - 1) Then

Alexis Martnez Bruno

Grupo: 5102

Matricula: 090260154-1

fila = fila + 1 Actualiza() Else MsgBox("Ultimo Registro Encontrado", MsgBoxStyle.Information, "Mensaje") End If End Sub

Boton Regresar
Private Sub Regresar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Regresar.Click Me.Close() MenuPrincipal.Show() End Sub

Funciones
Public Sub Actualiza() TextClavematASG.Text = CInt(dt.Rows(fila)("Clavemat")) TextClaveprofeASG.Text = CInt(dt.Rows(fila)("Claveprofe")) TextNumgrupoASG.Text = CInt(dt.Rows(fila)("Numgrupo")) End Sub Private Sub Refrescar() dt.Reset() fila = 0 Dim RefrescarDatos As String = "Select * From Asignatura" Dim dataAdapter As New OleDb.OleDbDataAdapter(RefrescarDatos, cn) dataAdapter.Fill(dt) Actualiza() dataAdapter.Dispose() End Sub Private Sub Ver() Dim ver As String = "SELECT * FROM Asignatura" Dim dataAdapter As New OleDb.OleDbDataAdapter(ver, cn) dataAdapter.Fill(dt) TextClavematASG.Text = CInt(dt.Rows(fila)("Clavemat")) TextClaveprofeASG.Text = CInt(dt.Rows(fila)("Claveprofe")) TextNumgrupoASG.Text = CInt(dt.Rows(fila)("Numgrupo")) End Sub

Boton Altas
Private Sub Guardar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Guardar.Click cn.Open()

Alexis Martnez Bruno

Grupo: 5102

Matricula: 090260154-1

Dim Guardar As String = " Insert Into Asignatura(Clavemat,Claveprofe,Numgrupo)" & "Values('" & TextClavematASG.Text & "','" & TextClaveprofeASG.Text & "','" & TextNumgrupoASG.Text & "')" Dim dataAdapter As New OleDb.OleDbDataAdapter(Guardar, cn) dataAdapter.Fill(dt) MsgBox("Se Guardo registro Correctamente", MsgBoxStyle.Information, "Mensaje") dataAdapter.Dispose() cn.Close() End Sub

Boton Bajas
Private Sub Bajas_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bajas.Click If ((MsgBox(" Desea Eliminar ? " + TextClavematASG.Text, MsgBoxStyle.OkCancel, "Mensaje")) = 1) Then Dim Baja As String = "Delete From Asignatura Where Clavemat=" & CInt(TextClavematASG.Text) Dim dataAdapter As New OleDb.OleDbDataAdapter(Baja, cn) dataAdapter.Fill(dt) Refrescar() Actualiza() dataAdapter.Dispose() Else MsgBox("No se ha seleccionado registro a eliminar") End If End Sub

Boton Consultas
Private Sub Consultar_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Consultar.Click cn.Open() Dim Consulta As String = "Select * From Asignatura Where Clavemat=" & CInt(TextClavematASG.Text()) Dim dataAdapter As New OleDb.OleDbDataAdapter(Consulta, cn) dt.Reset() dataAdapter.Fill(dt) fila = 0 Actualiza() dataAdapter.Dispose() cn.Close() End Sub

Boton Modificaciones
Private Sub Modificar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Modificar.Click cn.Open() Dim ModificaDatos As String = "Update Asignatura Set Clavemat ='" & TextClavematASG.Text & "', Claveprofe ='" & TextClaveprofeASG.Text & "', Numgrupo ='" & TextNumgrupoASG.Text & "' Where Clavemat=" & Clave & ";" Dim dataAdapter As New OleDb.OleDbDataAdapter(ModificaDatos, cn) dataAdapter.Fill(dt) dataAdapter.Dispose() MsgBox("Registro Modificado", MsgBoxStyle.Information, "Mensaje") cn.Close() End Sub

Boton Regresar
Private Sub Regresar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Regresar.Click Me.Close() MenuPrincipal.Show() End Sub

Boton Ver
Private Sub VerRegistros_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VerRegistros.Click Ver()

Alexis Martnez Bruno


End Sub

Grupo: 5102

Matricula: 090260154-1

Boton Anterior
Private Sub Anterior_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Anterior.Click If (fila > 0 And fila <= dt.Rows.Count - 1) Then fila = fila - 1 Actualiza() Else MsgBox("Primer Registro Encontrado", MsgBoxStyle.Information, "Mensaje") End If End Sub

Boton Siguiente
Private Sub Siguiente_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Siguiente.Click If (fila >= 0 And fila < dt.Rows.Count - 1) Then fila = fila + 1 Actualiza() Else MsgBox("Ultimo Registro Encontrado", MsgBoxStyle.Information, "Mensaje") End If End Sub End Class

Funciones
Public Sub Actualiza() TextNumgrupoGRP.Text = CInt(dt.Rows(fila)("Numgrupo")) TextCantidadAlumnosGRP.Text = CInt(dt.Rows(fila)("Cantidadalumnos")) TextClavematGRP.Text = CInt(dt.Rows(fila)("Clavemat")) End Sub Private Sub Refrescar() dt.Reset() fila = 0 Dim RefrescarDatos As String = "Select * From Grupos" Dim dataAdapter As New OleDb.OleDbDataAdapter(RefrescarDatos, cn) dataAdapter.Fill(dt) Actualiza() dataAdapter.Dispose() End Sub Private Sub Ver() Dim ver As String = "SELECT * FROM Grupos" Dim dataAdapter As New OleDb.OleDbDataAdapter(ver, cn) dataAdapter.Fill(dt) TextNumgrupoGRP.Text = CInt(dt.Rows(fila)("Numgrupo")) TextCantidadAlumnosGRP.Text = CInt(dt.Rows(fila)("Cantidadalumnos")) TextClavematGRP.Text = CInt(dt.Rows(fila)("Clavemat"))

Alexis Martnez Bruno


End Sub

Grupo: 5102

Matricula: 090260154-1

Boton Altas
Private Sub Altas_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Altas.Click Me.Close() AltasGrupos.Show() End Sub

Boton Bajas
Private Sub Bajas_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bajas.Click If ((MsgBox(" Desea Eliminar ? " + TextNumgrupoGRP.Text, MsgBoxStyle.OkCancel, "Mensaje")) = 1) Then Dim Baja As String = "Delete From Grupos Where Numgrupo=" & CInt(TextNumgrupoGRP.Text) Dim dataAdapter As New OleDb.OleDbDataAdapter(Baja, cn) dataAdapter.Fill(dt) Refrescar() Actualiza() dataAdapter.Dispose() Else MsgBox("No se ha seleccionado registro a eliminar") End If End Sub

Boton Consultas
Private Sub Buscar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buscar.Click cn.Open() Dim Buscar As String = "Select * From Grupos Where Numgrupo=" & CInt(TextNumgrupoGRP.Text()) Grupo = TextNumgrupoGRP.Text Dim dataAdapter As New OleDb.OleDbDataAdapter(Buscar, cn) dt.Reset() dataAdapter.Fill(dt) fila = 0 Actualiza() dataAdapter.Dispose() cn.Close() End Sub

Boton Modificaciones
Private Sub Modificar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Modificar.Click cn.Open() Dim ModificaDatos As String = "Update Grupos Set Numgrupo='" & TextNumgrupoGRP.Text & "', Cantidadalumnos ='" & TextCantidadAlumnosGRP.Text & "', Clavemat ='" & TextClavematGRP.Text & "' Where Numgrupo=" & Grupo & ";" Dim dataAdapter As New OleDb.OleDbDataAdapter(ModificaDatos, cn) dataAdapter.Fill(dt) dataAdapter.Dispose() MsgBox("Registro Modificado", MsgBoxStyle.Information, "Mensaje") cn.Close() End Sub

Boton Ver
Private Sub VerRegistros_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VerRegistros.Click Ver() End Sub

Boton Regresar
Private Sub Regresar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Regresar.Click Me.Close() MenuPrincipal.Show()

Alexis Martnez Bruno


End Sub

Grupo: 5102

Matricula: 090260154-1

Boton Anterior
Private Sub Anterior_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Anterior.Click If (fila > 0 And fila <= dt.Rows.Count - 1) Then fila = fila - 1 Actualiza() Else MsgBox("Primer Registro Encontrado", MsgBoxStyle.Information, "Mensaje") End If End Sub

Boton Siguiente
Private Sub Siguiente_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Siguiente.Click If (fila >= 0 And fila < dt.Rows.Count - 1) Then fila = fila + 1 Actualiza() Else MsgBox("Ultimo Registro Encontrado", MsgBoxStyle.Information, "Mensaje") End If End Sub End Class

Funciones
Private Sub Refrescar() dt.Reset() fila = 0 Dim RefrescarDatos As String = "Select * From Maestros" Dim dataAdapter As New OleDb.OleDbDataAdapter(RefrescarDatos, cn) dataAdapter.Fill(dt) Actualiza() dataAdapter.Dispose() End Sub Public Sub Actualiza() TextClaveprofeMTS.Text = CInt(dt.Rows(fila)("Claveprofe")) TextNombreMTS.Text = CStr(dt.Rows(fila)("Nombre")) TextPaternoMTS.Text = CStr(dt.Rows(fila)("Paterno")) TextMaternoMTS.Text = CStr(dt.Rows(fila)("Materno")) TextProfesionMTS.Text = CStr(dt.Rows(fila)("Profesion")) TextFechanacMTS.Text = CDate(dt.Rows(fila)("Fechanac")) End Sub Private Sub Ver()

Alexis Martnez Bruno

Grupo: 5102

Matricula: 090260154-1

Dim ver As String = "SELECT * FROM Maestros" Dim dataAdapter As New OleDb.OleDbDataAdapter(ver, cn) dataAdapter.Fill(dt) TextClaveprofeMTS.Text = CInt(dt.Rows(fila)("Claveprofe")) TextNombreMTS.Text = CStr(dt.Rows(fila)("Nombre")) TextPaternoMTS.Text = CStr(dt.Rows(fila)("Paterno")) TextMaternoMTS.Text = CStr(dt.Rows(fila)("Materno")) TextProfesionMTS.Text = CStr(dt.Rows(fila)("Profesion")) TextFechanacMTS.Text = CDate(dt.Rows(fila)("Fechanac")) dataAdapter.Dispose() End Sub

Boton Altas
Private Sub Guardar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Guardar.Click cn.Open() Dim Guardar As String = " Insert Into Maestros(Claveprofe,Nombre,Paterno,Materno,Profesion,Fechanac)" & "Values('" & TextClaveprofeMTS.Text & "','" & TextNombreMTS.Text & "','" & TextPaternoMTS.Text & "','" & TextMaternoMTS.Text & "','" & TextProfesionMTS.Text & "','" & TextFechanacMTS.Text & "')" Dim dataAdapter As New OleDb.OleDbDataAdapter(Guardar, cn) dataAdapter.Fill(dt) MsgBox("Se Guardo registro Correctamente", MsgBoxStyle.Information, "Mensaje") dataAdapter.Dispose() cn.Close() End Sub

Boton Bajas
Private Sub Bajas_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bajas.Click If ((MsgBox("... Desea Eliminar ? " + TextClaveprofeMTS.Text, MsgBoxStyle.OkCancel, "Mensaje")) = 1) Then Dim Borrar As String = "DELETE FROM Maestros WHERE Claveprofe=" & CInt(TextClaveprofeMTS.Text) Dim dataAdapter As New OleDb.OleDbDataAdapter(Borrar, cn) dataAdapter.Fill(dt) Refrescar() Actualiza() dataAdapter.Dispose() Else MsgBox("No se ha seleccionado registro a eliminar") End If End Sub

Boton Consultas
Private Sub Buscar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buscar.Click cn.Open() Dim Busc As String = "Select * From Maestros Where Claveprofe=" & CInt(TextClaveprofeMTS.Text()) Clav = TextClaveprofeMTS.Text Dim dataAdapter As New OleDb.OleDbDataAdapter(Busc, cn) dt.Reset() dataAdapter.Fill(dt) fila = 0 Actualiza() dataAdapter.Dispose() cn.Close() End Sub

Boton Modificaciones
Private Sub Modificar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Modificar.Click cn.Open()

Alexis Martnez Bruno

Grupo: 5102

Matricula: 090260154-1

Dim ModificaDatos As String = "Update Maestros Set Claveprofe= '" & TextClaveprofeMTS.Text & "', Nombre ='" & TextNombreMTS.Text & "', Paterno ='" & TextPaternoMTS.Text & "', Materno ='" & TextMaternoMTS.Text & "', Profesion ='" & TextProfesionMTS.Text & "', Fechanac ='" & TextFechanacMTS.Text & "' Where Claveprofe =" & Clav & ";" Dim dataAdapter As New OleDb.OleDbDataAdapter(ModificaDatos, cn) dataAdapter.Fill(dt) dataAdapter.Dispose() MsgBox("Registro Modificado", MsgBoxStyle.Information, "Mensaje") cn.Close() End Sub

Boton Ver
Private Sub VerRegistros_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VerRegistros.Click Ver() End Sub

Boton Regresar
Private Sub Regresar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Regresar.Click Me.Close() MenuPrincipal.Show() End Sub

Boton Anterior
Private Sub Anterior_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Anterior.Click If (fila > 0 And fila <= dt.Rows.Count - 1) Then fila = fila - 1 Actualiza() Else MsgBox("Primer Registro Encontrado", MsgBoxStyle.Information, "Mensaje") End If End Sub

Boton Siguiente
Private Sub Siguiente_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Siguiente.Click If (fila >= 0 And fila < dt.Rows.Count - 1) Then fila = fila + 1 Actualiza() Else MsgBox("Ultimo Registro Encontrado", MsgBoxStyle.Information, "Mensaje") End If End Sub End Class

Alexis Martnez Bruno

Grupo: 5102

Matricula: 090260154-1

Funciones
Private Sub Refrescar() dt.Reset() fila = 0 Dim RefrescarDatos As String = "Select * From Materias" Dim dataAdapter As New OleDb.OleDbDataAdapter(RefrescarDatos, cn) dataAdapter.Fill(dt) Actualiza() dataAdapter.Dispose() End Sub Public Sub Actualiza() TextClavematMAT.Text = CInt(dt.Rows(fila)("Clavemat")) TextNombreMAT.Text = CStr(dt.Rows(fila)("Nombre")) TextHorastotalesMAT.Text = CInt(dt.Rows(fila)("Horastotales")) TextHoraspMAT.Text = CInt(dt.Rows(fila)("Horasp")) TextHorastMAT.Text = CInt(dt.Rows(fila)("Horast")) TextFechanacMAT.Text = CDate(dt.Rows(fila)("Fechanac")) End Sub Private Sub Ver() Dim ver As String = "SELECT * FROM Materias" Dim dataAdapter As New OleDb.OleDbDataAdapter(ver, cn) dataAdapter.Fill(dt) TextClavematMAT.Text = CInt(dt.Rows(fila)("Clavemat")) TextNombreMAT.Text = CStr(dt.Rows(fila)("Nombre")) TextHorastotalesMAT.Text = CInt(dt.Rows(fila)("Horastotales")) TextHoraspMAT.Text = CInt(dt.Rows(fila)("Horasp")) TextHorastMAT.Text = CInt(dt.Rows(fila)("Horast")) TextFechanacMAT.Text = CDate(dt.Rows(fila)("Fechanac")) dataAdapter.Dispose() End Sub

Boton Altas
Private Sub Guardar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Guardar.Click cn.Open() Dim Guardar As String = " Insert Into Materias(Clavemat,Nombre,Horastotales,Horasp,Horast,Fechanac)" & "Values('" & TextClavematMAT.Text & "','" & TextNombreMAT.Text & "','" & TextHorastotalesMAT.Text & "','" & TextHoraspMAT.Text & "','" & TextHorastMAT.Text & "','" & TextFechanacMAT.Text & "')" Dim dataAdapter As New OleDb.OleDbDataAdapter(Guardar, cn) dataAdapter.Fill(dt)

Alexis Martnez Bruno

Grupo: 5102

Matricula: 090260154-1

MsgBox("Se Guardo registro Correctamente", MsgBoxStyle.Information, "Mensaje") dataAdapter.Dispose() cn.Close() End Sub

Boton Bajas
Private Sub Bajas_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bajas.Click If ((MsgBox("... Desea Eliminar ? " + TextClavematMAT.Text, MsgBoxStyle.OkCancel, "Mensaje")) = 1) Then Dim Borrar As String = "DELETE FROM Materias WHERE Clavemat=" & CInt(TextClavematMAT.Text) Dim dataAdapter As New OleDb.OleDbDataAdapter(Borrar, cn) dataAdapter.Fill(dt) Refrescar() Actualiza() dataAdapter.Dispose() Else MsgBox("No se ha seleccionado registro a eliminar") End If End Sub

Boton Consultas
Private Sub Buscar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buscar.Click cn.Open() Dim Buscar As String = "Select * From Materias Where Clavemat=" & CInt(TextClavematMAT.Text()) Key = TextClavematMAT.Text Dim dataAdapter As New OleDb.OleDbDataAdapter(Buscar, cn) dt.Reset() dataAdapter.Fill(dt) fila = 0 Actualiza() dataAdapter.Dispose() cn.Close() End Sub

Boton Modificaciones
Private Sub Modificar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Modificar.Click cn.Open() Dim ModificaDatos As String = "Update Materias Set Clavemat= '" & TextClavematMAT.Text & "', Nombre ='" & TextNombreMAT.Text & "', Horastotales ='" & TextHorastotalesMAT.Text & "', Horasp='" & TextHoraspMAT.Text & "', Horast='" & TextHorastMAT.Text & "', Fechanac='" & TextFechanacMAT.Text & "' Where Clavemat=" & Key & ";" Dim dataAdapter As New OleDb.OleDbDataAdapter(ModificaDatos, cn) dataAdapter.Fill(dt) dataAdapter.Dispose() MsgBox("Registro Modificado", MsgBoxStyle.Information, "Mensaje") cn.Close() End Sub

Boton Ver
Private Sub VerRegistros_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VerRegistros.Click Ver() End Sub

Boton Regresar
Private Sub Regresar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Regresar.Click Me.Close() MenuPrincipal.Show() End Sub

Alexis Martnez Bruno

Grupo: 5102

Matricula: 090260154-1

Boton Anterior
Private Sub Anterior_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Anterior.Click If (fila > 0 And fila <= dt.Rows.Count - 1) Then fila = fila - 1 Actualiza() Else MsgBox("Primer Registro Encontrado", MsgBoxStyle.Information, "Mensaje") End If End Sub

Boton Siguiente
Private Sub Siguiente_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Siguiente.Click If (fila >= 0 And fila < dt.Rows.Count - 1) Then fila = fila + 1 Actualiza() Else MsgBox("Ultimo Registro Encontrado", MsgBoxStyle.Information, "Mensaje") End If End Sub End Class