You are on page 1of 101

IMPLEMENTACION SISTEMA EN VISUAL.

NET

Cree una aplicación que permita automatizar el proceso de registro de


solicitudes, toma de exámenes atrasados y cambios de centro.

Diseñar las siguientes tablas:


Estudiante

Imports System.Data.SqlClient
Public Class frmActEstudiante
Inherits System.Windows.Forms.Form
Dim daEstudiante As SqlDataAdapter
Dim objDataSet As DataSet
Dim flag As Integer
Dim resultado As Integer
Dim strCodigo As String

Const spExploracion = "Estudiante: Exploración de registros"


Const spNuevo = "Estudiante: Nuevo Registro"
Const spModificacion = "Estudiante: Modificación del Registro"
Dim SQLAdapter_Master As SqlDataAdapter
Dim DataSet_Master As DataSet
#Region " Código generado por el Diseñador de Windows Forms "

Public Sub New()


MyBase.New()
'El Diseñador de Windows Forms requiere esta llamada.
InitializeComponent()

'Agregar cualquier inicialización después de la llamada a


InitializeComponent()

End Sub

'Form reemplaza a Dispose para limpiar la lista de componentes.


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Requerido por el Diseñador de Windows Forms


Private components As System.ComponentModel.IContainer

'NOTA: el Diseñador de Windows Forms requiere el siguiente procedimiento


'Puede modificarse utilizando el Diseñador de Windows Forms.
'No lo modifique con el editor de código.
Friend WithEvents txtFechaIngreso As System.Windows.Forms.TextBox
Friend WithEvents Label7 As System.Windows.Forms.Label
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents txtTipo As System.Windows.Forms.TextBox
Friend WithEvents txtApellidos As System.Windows.Forms.TextBox
Friend WithEvents txtNombres As System.Windows.Forms.TextBox
Friend WithEvents txtCodigo As System.Windows.Forms.TextBox
Friend WithEvents lblRegistro As System.Windows.Forms.Label
Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
Friend WithEvents btnBuscar As System.Windows.Forms.Button
Friend WithEvents btnSalir As System.Windows.Forms.Button
Friend WithEvents btnEliminar As System.Windows.Forms.Button
Friend WithEvents btnCancelar As System.Windows.Forms.Button
Friend WithEvents btnGuardar As System.Windows.Forms.Button
Friend WithEvents btnEditar As System.Windows.Forms.Button
Friend WithEvents btnNuevo As System.Windows.Forms.Button
Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents btnUltimo As System.Windows.Forms.Button
Friend WithEvents btnSiguiente As System.Windows.Forms.Button
Friend WithEvents btnAnterior As System.Windows.Forms.Button
Friend WithEvents btnPrimero As System.Windows.Forms.Button
Friend WithEvents HelpProvider1 As System.Windows.Forms.HelpProvider
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.ComponentModel.ComponentResourceManager = New
System.ComponentModel.ComponentResourceManager(GetType(frmActEstudiante))
Me.txtFechaIngreso = New System.Windows.Forms.TextBox
Me.Label7 = New System.Windows.Forms.Label
Me.Label5 = New System.Windows.Forms.Label
Me.Label3 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.Label1 = New System.Windows.Forms.Label
Me.txtTipo = New System.Windows.Forms.TextBox
Me.txtApellidos = New System.Windows.Forms.TextBox
Me.txtNombres = New System.Windows.Forms.TextBox
Me.txtCodigo = New System.Windows.Forms.TextBox
Me.lblRegistro = New System.Windows.Forms.Label
Me.GroupBox2 = New System.Windows.Forms.GroupBox
Me.btnBuscar = New System.Windows.Forms.Button
Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
Me.btnSalir = New System.Windows.Forms.Button
Me.btnEliminar = New System.Windows.Forms.Button
Me.btnCancelar = New System.Windows.Forms.Button
Me.btnGuardar = New System.Windows.Forms.Button
Me.btnEditar = New System.Windows.Forms.Button
Me.btnNuevo = New System.Windows.Forms.Button
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.btnUltimo = New System.Windows.Forms.Button
Me.btnSiguiente = New System.Windows.Forms.Button
Me.btnAnterior = New System.Windows.Forms.Button
Me.btnPrimero = New System.Windows.Forms.Button
Me.HelpProvider1 = New System.Windows.Forms.HelpProvider
Me.GroupBox2.SuspendLayout()
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'txtFechaIngreso
'
Me.txtFechaIngreso.Font = New System.Drawing.Font("Microsoft Sans
Serif", 8.25!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtFechaIngreso.ForeColor = System.Drawing.SystemColors.HotTrack
Me.txtFechaIngreso.Location = New System.Drawing.Point(168, 112)
Me.txtFechaIngreso.Name = "txtFechaIngreso"
Me.txtFechaIngreso.Size = New System.Drawing.Size(160, 20)
Me.txtFechaIngreso.TabIndex = 61
'
'Label7
'
Me.Label7.BackColor = System.Drawing.Color.Transparent
Me.Label7.Font = New System.Drawing.Font("Comic Sans MS", 9.75!,
CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline),
System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label7.ForeColor = System.Drawing.Color.Blue
Me.Label7.Location = New System.Drawing.Point(24, 112)
Me.Label7.Name = "Label7"
Me.Label7.Size = New System.Drawing.Size(152, 24)
Me.Label7.TabIndex = 60
Me.Label7.Text = "Fecha de Ingreso:"
'
'Label5
'
Me.Label5.BackColor = System.Drawing.Color.Transparent
Me.Label5.Font = New System.Drawing.Font("Comic Sans MS", 9.75!,
CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline),
System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label5.ForeColor = System.Drawing.Color.Blue
Me.Label5.Location = New System.Drawing.Point(24, 144)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(127, 24)
Me.Label5.TabIndex = 59
Me.Label5.Text = "Tipo de Estudiante:"
'
'Label3
'
Me.Label3.BackColor = System.Drawing.Color.Transparent
Me.Label3.Font = New System.Drawing.Font("Comic Sans MS", 9.75!,
CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline),
System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label3.ForeColor = System.Drawing.Color.Blue
Me.Label3.Location = New System.Drawing.Point(24, 80)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(100, 23)
Me.Label3.TabIndex = 58
Me.Label3.Text = "Apellidos:"
'
'Label2
'
Me.Label2.BackColor = System.Drawing.Color.Transparent
Me.Label2.Font = New System.Drawing.Font("Comic Sans MS", 9.75!,
CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline),
System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label2.ForeColor = System.Drawing.Color.Blue
Me.Label2.Location = New System.Drawing.Point(24, 48)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(100, 23)
Me.Label2.TabIndex = 57
Me.Label2.Text = "Nombres:"
'
'Label1
'
Me.Label1.BackColor = System.Drawing.Color.Transparent
Me.Label1.Font = New System.Drawing.Font("Comic Sans MS", 9.75!,
CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline),
System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.ForeColor = System.Drawing.Color.Blue
Me.Label1.Location = New System.Drawing.Point(24, 8)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(48, 23)
Me.Label1.TabIndex = 56
Me.Label1.Text = "Código:"
'
'txtTipo
'
Me.txtTipo.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.txtTipo.ForeColor = System.Drawing.SystemColors.HotTrack
Me.txtTipo.Location = New System.Drawing.Point(168, 144)
Me.txtTipo.Name = "txtTipo"
Me.txtTipo.Size = New System.Drawing.Size(128, 20)
Me.txtTipo.TabIndex = 55
'
'txtApellidos
'
Me.txtApellidos.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.txtApellidos.ForeColor = System.Drawing.SystemColors.HotTrack
Me.txtApellidos.Location = New System.Drawing.Point(168, 80)
Me.txtApellidos.Name = "txtApellidos"
Me.txtApellidos.Size = New System.Drawing.Size(128, 20)
Me.txtApellidos.TabIndex = 54
'
'txtNombres
'
Me.txtNombres.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.txtNombres.ForeColor = System.Drawing.SystemColors.HotTrack
Me.txtNombres.Location = New System.Drawing.Point(168, 48)
Me.txtNombres.Name = "txtNombres"
Me.txtNombres.Size = New System.Drawing.Size(128, 20)
Me.txtNombres.TabIndex = 53
'
'txtCodigo
'
Me.txtCodigo.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.txtCodigo.ForeColor = System.Drawing.SystemColors.HotTrack
Me.txtCodigo.Location = New System.Drawing.Point(112, 8)
Me.txtCodigo.Name = "txtCodigo"
Me.txtCodigo.Size = New System.Drawing.Size(72, 20)
Me.txtCodigo.TabIndex = 52
'
'lblRegistro
'
Me.lblRegistro.Font = New System.Drawing.Font("Times New Roman",
14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.lblRegistro.ForeColor = System.Drawing.Color.Blue
Me.lblRegistro.Location = New System.Drawing.Point(356, 35)
Me.lblRegistro.Name = "lblRegistro"
Me.lblRegistro.Size = New System.Drawing.Size(192, 24)
Me.lblRegistro.TabIndex = 98
Me.lblRegistro.Text = "Registro:"
'
'GroupBox2
'
Me.GroupBox2.BackColor = System.Drawing.Color.Transparent
Me.GroupBox2.Controls.Add(Me.btnBuscar)
Me.GroupBox2.Controls.Add(Me.btnSalir)
Me.GroupBox2.Controls.Add(Me.btnEliminar)
Me.GroupBox2.Controls.Add(Me.btnCancelar)
Me.GroupBox2.Controls.Add(Me.btnGuardar)
Me.GroupBox2.Controls.Add(Me.btnEditar)
Me.GroupBox2.Controls.Add(Me.btnNuevo)
Me.GroupBox2.Location = New System.Drawing.Point(16, 208)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(600, 56)
Me.GroupBox2.TabIndex = 96
Me.GroupBox2.TabStop = False
'
'btnBuscar
'
Me.btnBuscar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnBuscar.ForeColor = System.Drawing.Color.Red
Me.btnBuscar.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnBuscar.ImageIndex = 7
Me.btnBuscar.ImageList = Me.ImageList1
Me.btnBuscar.Location = New System.Drawing.Point(344, 16)
Me.btnBuscar.Name = "btnBuscar"
Me.btnBuscar.Size = New System.Drawing.Size(80, 24)
Me.btnBuscar.TabIndex = 6
Me.btnBuscar.Text = "&Buscar"
'
'ImageList1
'
Me.ImageList1.ImageStream =
CType(resources.GetObject("ImageList1.ImageStream"),
System.Windows.Forms.ImageListStreamer)
Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent
Me.ImageList1.Images.SetKeyName(0, "")
Me.ImageList1.Images.SetKeyName(1, "")
Me.ImageList1.Images.SetKeyName(2, "")
Me.ImageList1.Images.SetKeyName(3, "")
Me.ImageList1.Images.SetKeyName(4, "")
Me.ImageList1.Images.SetKeyName(5, "")
Me.ImageList1.Images.SetKeyName(6, "")
Me.ImageList1.Images.SetKeyName(7, "")
Me.ImageList1.Images.SetKeyName(8, "")
Me.ImageList1.Images.SetKeyName(9, "")
Me.ImageList1.Images.SetKeyName(10, "")
Me.ImageList1.Images.SetKeyName(11, "")
Me.ImageList1.Images.SetKeyName(12, "")
Me.ImageList1.Images.SetKeyName(13, "")
Me.ImageList1.Images.SetKeyName(14, "")
'
'btnSalir
'
Me.btnSalir.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnSalir.ForeColor = System.Drawing.Color.Red
Me.btnSalir.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnSalir.ImageIndex = 6
Me.btnSalir.ImageList = Me.ImageList1
Me.btnSalir.Location = New System.Drawing.Point(504, 16)
Me.btnSalir.Name = "btnSalir"
Me.btnSalir.Size = New System.Drawing.Size(80, 24)
Me.btnSalir.TabIndex = 5
Me.btnSalir.Text = "&Salir"
'
'btnEliminar
'
Me.btnEliminar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnEliminar.ForeColor = System.Drawing.Color.Red
Me.btnEliminar.ImageAlign =
System.Drawing.ContentAlignment.MiddleRight
Me.btnEliminar.ImageList = Me.ImageList1
Me.btnEliminar.Location = New System.Drawing.Point(432, 16)
Me.btnEliminar.Name = "btnEliminar"
Me.btnEliminar.Size = New System.Drawing.Size(64, 24)
Me.btnEliminar.TabIndex = 4
Me.btnEliminar.Text = "&Eliminar"
'
'btnCancelar
'
Me.btnCancelar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnCancelar.ForeColor = System.Drawing.Color.Red
Me.btnCancelar.ImageList = Me.ImageList1
Me.btnCancelar.Location = New System.Drawing.Point(272, 16)
Me.btnCancelar.Name = "btnCancelar"
Me.btnCancelar.Size = New System.Drawing.Size(64, 24)
Me.btnCancelar.TabIndex = 3
Me.btnCancelar.Text = "&Cancelar"
'
'btnGuardar
'
Me.btnGuardar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnGuardar.ForeColor = System.Drawing.Color.Red
Me.btnGuardar.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnGuardar.ImageIndex = 10
Me.btnGuardar.ImageList = Me.ImageList1
Me.btnGuardar.Location = New System.Drawing.Point(176, 16)
Me.btnGuardar.Name = "btnGuardar"
Me.btnGuardar.Size = New System.Drawing.Size(88, 24)
Me.btnGuardar.TabIndex = 2
Me.btnGuardar.Text = "&Guardar"
'
'btnEditar
'
Me.btnEditar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnEditar.ForeColor = System.Drawing.Color.Red
Me.btnEditar.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnEditar.ImageList = Me.ImageList1
Me.btnEditar.Location = New System.Drawing.Point(104, 16)
Me.btnEditar.Name = "btnEditar"
Me.btnEditar.Size = New System.Drawing.Size(64, 24)
Me.btnEditar.TabIndex = 1
Me.btnEditar.Text = "&Editar"
'
'btnNuevo
'
Me.btnNuevo.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnNuevo.ForeColor = System.Drawing.Color.Red
Me.btnNuevo.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnNuevo.ImageIndex = 14
Me.btnNuevo.ImageList = Me.ImageList1
Me.btnNuevo.Location = New System.Drawing.Point(8, 16)
Me.btnNuevo.Name = "btnNuevo"
Me.btnNuevo.Size = New System.Drawing.Size(80, 24)
Me.btnNuevo.TabIndex = 0
Me.btnNuevo.Text = "&Nuevo"
'
'GroupBox1
'
Me.GroupBox1.BackColor = System.Drawing.Color.Transparent
Me.GroupBox1.Controls.Add(Me.btnUltimo)
Me.GroupBox1.Controls.Add(Me.btnSiguiente)
Me.GroupBox1.Controls.Add(Me.btnAnterior)
Me.GroupBox1.Controls.Add(Me.btnPrimero)
Me.GroupBox1.ForeColor = System.Drawing.SystemColors.ActiveCaption
Me.GroupBox1.Location = New System.Drawing.Point(348, 83)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(240, 88)
Me.GroupBox1.TabIndex = 97
Me.GroupBox1.TabStop = False
'
'btnUltimo
'
Me.btnUltimo.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnUltimo.ForeColor = System.Drawing.Color.Navy
Me.btnUltimo.Location = New System.Drawing.Point(128, 56)
Me.btnUltimo.Name = "btnUltimo"
Me.btnUltimo.Size = New System.Drawing.Size(96, 23)
Me.btnUltimo.TabIndex = 3
Me.btnUltimo.Text = " &Ultimo >>"
'
'btnSiguiente
'
Me.btnSiguiente.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnSiguiente.ForeColor = System.Drawing.Color.Navy
Me.btnSiguiente.Location = New System.Drawing.Point(128, 16)
Me.btnSiguiente.Name = "btnSiguiente"
Me.btnSiguiente.Size = New System.Drawing.Size(96, 24)
Me.btnSiguiente.TabIndex = 2
Me.btnSiguiente.Text = " &Siguiente >>"
'
'btnAnterior
'
Me.btnAnterior.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnAnterior.ForeColor = System.Drawing.Color.Navy
Me.btnAnterior.Location = New System.Drawing.Point(16, 56)
Me.btnAnterior.Name = "btnAnterior"
Me.btnAnterior.Size = New System.Drawing.Size(88, 24)
Me.btnAnterior.TabIndex = 1
Me.btnAnterior.Text = "<< &Anterior"
'
'btnPrimero
'
Me.btnPrimero.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnPrimero.ForeColor = System.Drawing.Color.Navy
Me.btnPrimero.Location = New System.Drawing.Point(16, 16)
Me.btnPrimero.Name = "btnPrimero"
Me.btnPrimero.Size = New System.Drawing.Size(88, 23)
Me.btnPrimero.TabIndex = 0
Me.btnPrimero.Text = "<< &Primero"
'
'HelpProvider1
'
Me.HelpProvider1.HelpNamespace =
"D:\Proyecto_Taller_II\Prototipo_Visual\HTML\ActAlumnosSAM.htm"
'
'frmActEstudiante
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.Color.Gray
Me.ClientSize = New System.Drawing.Size(632, 302)
Me.Controls.Add(Me.GroupBox2)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.txtFechaIngreso)
Me.Controls.Add(Me.Label7)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.txtTipo)
Me.Controls.Add(Me.txtApellidos)
Me.Controls.Add(Me.txtNombres)
Me.Controls.Add(Me.txtCodigo)
Me.Controls.Add(Me.lblRegistro)
Me.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte),
Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer),
CType(CType(0, Byte), Integer))
Me.HelpButton = True
Me.HelpProvider1.SetHelpKeyword(Me, "Estudiante")
Me.HelpProvider1.SetHelpNavigator(Me,
System.Windows.Forms.HelpNavigator.KeywordIndex)
Me.HelpProvider1.SetHelpString(Me, "Estudiante")
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmActEstudiante"
Me.HelpProvider1.SetShowHelp(Me, True)
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Actualizando Estudiante"
Me.GroupBox2.ResumeLayout(False)
Me.GroupBox1.ResumeLayout(False)
Me.ResumeLayout(False)
Me.PerformLayout()

End Sub

#End Region

Private Sub ConfiguraControles(ByVal stStatus As Integer)


txtCodigo.Enabled = False '(stStatus = 1)
txtNombres.Enabled = (stStatus = 1) Or (stStatus = 2)
txtApellidos.Enabled = (stStatus = 1) Or (stStatus = 2)
txtFechaIngreso.Enabled = (stStatus = 1) Or (stStatus = 2)
txtTipo.Enabled = (stStatus = 1) Or (stStatus = 2)
btnPrimero.Enabled = (stStatus = 0)
btnAnterior.Enabled = (stStatus = 0)
btnSiguiente.Enabled = (stStatus = 0)
btnUltimo.Enabled = (stStatus = 0)
btnNuevo.Enabled = (stStatus = 0)
btnEditar.Enabled = (stStatus = 0)
btnGuardar.Enabled = (stStatus = 1) Or (stStatus = 2)
btnCancelar.Enabled = (stStatus = 1) Or (stStatus = 2)
btnBuscar.Enabled = (stStatus = 0)
btnEliminar.Enabled = (stStatus = 0)

Select Case stStatus


Case 1 'Agregando nuevo registro
Me.Text = spNuevo
txtCodigo.Text = ""
txtNombres.Text = ""
txtApellidos.Text = ""
txtFechaIngreso.Text = ""
txtTipo.Text = ""
txtNombres.Focus()
Case 2 'Modificando registro
Me.Text = spModificacion
txtNombres.Focus()

Case Else ' Exploracion de datos


Me.Text = spExploracion
End Select
End Sub

Private Sub frmActEstudiante_Load(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles MyBase.Load
MODCONEXION.Conexion.Open()
daEstudiante = New SqlDataAdapter("Select * From Estudiante",
MODCONEXION.Conexion)
objDataSet = New DataSet()
daEstudiante.Fill(objDataSet, "Estudiante")
MODCONEXION.Conexion.Close()

Me.txtCodigo.DataBindings.Add("Text", objDataSet,
"Estudiante.Cod_Estudiante")
Me.txtApellidos.DataBindings.Add("text", objDataSet,
"Estudiante.Ape_Estudiante")
Me.txtNombres.DataBindings.Add("Text", objDataSet,
"Estudiante.Nom_Estudiante")
Me.txtFechaIngreso.DataBindings.Add("text", objDataSet,
"Estudiante.Fecha_Ingreso")
Me.txtTipo.DataBindings.Add("text", objDataSet,
"Estudiante.Tipo_Estudiante")
ConfiguraControles(0)

End Sub

Private Sub HabilitarControles(ByVal est As Boolean)

Dim ctrl As Control


For Each ctrl In Me.Controls
If TypeOf ctrl Is TextBox Then ctrl.Enabled = est
Next

End Sub

Private Sub HabilitarBotones(ByVal est As Boolean)


Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeOf ctrl Is Button Then ctrl.Enabled = est
Next
btnGuardar.Enabled = Not est
btnCancelar.Enabled = Not est
End Sub

Private Sub HabilitarEditar(ByVal est As Boolean)


Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeOf ctrl Is Button Then ctrl.Enabled = est
Next
btnEditar.Enabled = Not est
btnBuscar.Enabled = Not est
btnEliminar.Enabled = Not est
btnNuevo.Enabled = Not est
End Sub

Private Sub LimpiarControles()


Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeOf ctrl Is TextBox Then ctrl.Text = ""
Next
End Sub

Private Sub Actualizar()


objDataSet.Clear()
daAlumno.Fill(objDataSet, "Estudiante")
End Sub

Private Sub GeneraCodigo()


Dim cmd As New SqlCommand("select max(Cod_Estudiante)from Estudiante",
MODCONEXION.Conexion)
MODCONEXION.Conexion.Open()
strCodigo = cmd.ExecuteScalar
MODCONEXION.Conexion.Close()
txtCodigo.Text = Format(Val(strCodigo) + 1, "00000")
End Sub

Private Sub BotonB(ByVal VarX As Boolean)


btnSiguiente.Enabled = VarX
btnUltimo.Enabled = VarX
End Sub

Private Sub BotonA(ByVal VarX As Boolean)


btnPrimero.Enabled = VarX
btnAnterior.Enabled = VarX
End Sub

Private Sub NumRegistro()


Dim num, total As Integer
num = Me.BindingContext(objDataSet, "Estudiante").Position + 1
total = Me.objDataSet.Tables("Estudiante").Rows.Count
Me.lblRegistro.Text = "Reg: " & Str(num) & " de " & Str(total)
End Sub

Private Sub btnPrimero_Click_1(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnPrimero.Click
Me.BindingContext(Me.objDataSet, "Estudiante").Position = 0
Call BotonA(False)
Call BotonB(True)
Call NumRegistro()
End Sub

Private Sub btnSiguiente_Click_1(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnSiguiente.Click
If Me.BindingContext(objDataSet, "Estudiante").Position <
(Me.BindingContext(objDataSet, _
"Alumno").Count - 1) Then
Me.BindingContext(objDataSet, "Estudiante").Position = _
(Me.BindingContext(objDataSet, "Estudiante").Position + 1)
Call BotonA(True)
Else
Call BotonB(False)
End If
Me.NumRegistro()
End Sub

Private Sub btnAnterior_Click_1(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnAnterior.Click
If Me.BindingContext(objDataSet, "Estudiante").Position > 0 Then
Me.BindingContext(objDataSet, "Estudiante").Position = _
(Me.BindingContext(objDataSet, "Estudiante").Position - 1)
Call BotonB(True)
Else
Call BotonA(False)
End If
Me.NumRegistro()
End Sub
Private Sub btnUltimo_Click_1(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnUltimo.Click
Me.BindingContext(Me.objDataSet, "Estudiante").Position = _
(Me.objDataSet.Tables("Estudiante").Rows.Count - 1)
Call BotonB(False)
Call BotonA(True)
Me.NumRegistro()
End Sub

Private Sub btnBuscar_Click_1(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnBuscar.Click
Dim strDato As String
Dim fila As Integer
Dim dv As New DataView()
strDato = InputBox("Ingrese codigo de Estudiante", "Buscar", "")
strDato = Trim(strDato)
If Len(strDato) < 1 Then Exit Sub
dv.Table = objDataSet.Tables("Estudiante")
dv.Sort = "Cod_Estudiante"
fila = dv.Find(strDato)
If fila = -1 Then
MessageBox.Show("Codigo de Estudiante no existe", "Cuidado")
Exit Sub
End If
Me.BindingContext(objDataSet, "Estudiante").Position = fila
Call NumRegistro()
End Sub

Private Sub btnNuevo_Click_1(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnNuevo.Click
flag = 1
Call HabilitarBotones(False)
Call LimpiarControles()
Call GeneraCodigo()
Call HabilitarEditar(True)
'Call BotonA(False)
'Call BotonB(False)
ConfiguraControles(1)
End Sub

Private Sub btnEditar_Click_1(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnEditar.Click
flag = 2
ConfiguraControles(2)
End Sub

Private Sub btnCancelar_Click_1(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnCancelar.Click
MODCONEXION.Conexion.Open()
objDataSet.RejectChanges()
MODCONEXION.Conexion.Close()
btnAnterior.PerformClick()
ConfiguraControles(0)
End Sub

Private Sub btnEliminar_Click_1(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnEliminar.Click
Dim sql3 As String
sql3 = "delete from Estudiante where Cod_Estudiante=@Cod_Estudiante"
Dim objComando As New SqlCommand(sql3, MODCONEXION.Conexion)
Try
objComando.Parameters.Add(New SqlParameter("@Cod_Estudiante",
SqlDbType.VarChar))
objComando.Parameters("@Cod_Estudiante").Value = InputBox("Ingrese
el código del Estudiante a eliminar: ")
MODCONEXION.Conexion.Open()
resultado = objComando.ExecuteNonQuery
Call Actualizar()
btnAnterior.PerformClick() ' Para que muestre el registro anterior
luego de eliminar
MessageBox.Show("Registros Eliminados: " & resultado, "", 0,
MessageBoxIcon.Information)
Catch exc As Exception
MessageBox.Show(exc.Message)
End Try
MODCONEXION.Conexion.Close()

End Sub

Private Sub btnSalir_Click_1(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnSalir.Click
MODCONEXION.Conexion.Close()
Me.Close()
End Sub

Private Sub btnGuardar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnGuardar.Click
Dim sql, oper As String
If Not Datos_BienEscritos() Then
Exit Sub
End If

If flag = 1 Then ' Nuevo


sql = "INSERT INTO Estudiante (Cod_Estudiante,Ape_Estudiante,
Nom_Estudiante, Fecha_Ingreso, Tipo_Estudiante) VALUES
(@Cod_Estudiante,@Ape_Estudiante, @Nom_Estudiante, @Fecha_Ingreso,
@Tipo_Estudiante)"
oper = " insertados: "
Else ' Editar
sql = "UPDATE Estudiante SET Cod_Estudiante=@Cod_Estudiante ,
Ape_Estudiante=@Ape_Estudiante, Nom_Estudiante=@Nom_Estudiante,
Fecha_Ingreso=@Fecha_Ingreso,Tipo_Estudiante=@Tipo_Estudiante where
Cod_Estudiante=@Cod_Estudiante"
oper = " modificados: "
End If
'Creando comando
Dim objcomando As New SqlCommand(sql, MODCONEXION.Conexion)
Try
objcomando.Parameters.Add(New SqlParameter("@Cod_Estudiante",
SqlDbType.Char))
objcomando.Parameters("@Cod_Estudiante").Value = txtCodigo.Text

objcomando.Parameters.Add(New SqlParameter("@Ape_Estudiante",
SqlDbType.VarChar))
objcomando.Parameters("@Ape_Estudiante").Value = txtApellidos.Text

objcomando.Parameters.Add(New SqlParameter("@Nom_Estudiante",
SqlDbType.VarChar))
objcomando.Parameters("@Nom_Estudiante").Value = txtApellidos.Text

objcomando.Parameters.Add(New SqlParameter("@Fecha_Ingreso",
SqlDbType.DateTime))
objcomando.Parameters("@Fecha_Ingreso").Value =
txtFechaIngreso.Text

objcomando.Parameters.Add(New SqlParameter("@Tipo_Estudiante",
SqlDbType.VarChar))
objcomando.Parameters("@Tipo_Estudiante").Value = txtTipo.Text

MODCONEXION.Conexion.Open()
resultado = objcomando.ExecuteNonQuery
'Ejecuta una instrucción de Transact-SQL en Connection y devuelve
el número de filas afectadas.
Call Actualizar()
'Para actualizar posición
Call NumRegistro()
MessageBox.Show("Registros " & oper & resultado, "", 0,
MessageBoxIcon.Information)
ConfiguraControles(0)
Catch exc As Exception
MessageBox.Show(exc.Message)
End Try
MODCONEXION.Conexion.Close()
End Sub

Private Function CountRegistros(ByVal FieldCount As String, ByVal SQL As


String) As Integer
Dim oCNN As System.Data.SqlClient.SqlConnection
Dim oCMD As System.Data.SqlClient.SqlCommand
Dim oDRD As System.Data.SqlClient.SqlDataReader
Dim i As Integer
i = 0
oCNN = MODCONEXION.Conexion
oCMD = NewComando(oCNN, SQL, CommandType.Text)
Try
oCNN.Open()
oDRD = oCMD.ExecuteReader
If Not (oDRD.Read) Then
i = 0
Else
i = oDRD.Item(FieldCount)
End If
Catch xErr As Exception
MsgBox(xErr.Message)
Finally
oCNN.Close()
oCMD = Nothing
oDRD = Nothing
End Try
Return i
End Function
Private Function Datos_BienEscritos() As Boolean
Dim s As String
txtCodigo.Text = Trim(txtCodigo.Text)
txtNombres.Text = Trim(txtNombres.Text)
txtApellidos.Text = Trim(txtApellidos.Text)
txtFechaIngreso.Text = Trim(txtFechaIngreso.Text)
txtTipo.Text = Trim(txtTipo.Text)
If (Len(txtCodigo.Text) < 1) And (spModificacion = Me.Text) Then
MessageBox.Show("Escriba los nombres.Actualización cancelada",
"Faltan datos", 0, MessageBoxIcon.Information)
Return False
End If
If (Len(txtNombres.Text) < 1) Then
MessageBox.Show("Escriba los nombres.Actualización cancelada",
"Faltan datos", 0, MessageBoxIcon.Information)
txtNombres.Focus()
Return False
End If

If (Len(txtApellidos.Text) < 1) Then


MessageBox.Show("Escriba los Apellidos.Actualización cancelada",
"Faltan datos", 0, MessageBoxIcon.Information)
txtApellidos.Focus()
Return False
End If

If (Len(txtFechaIngreso.Text) < 1) Then


MessageBox.Show("Escriba los Apellidos.Actualización cancelada",
"Faltan datos", 0, MessageBoxIcon.Information)
txtFechaIngreso.Focus()
Return False
End If

If (Len(txtTipo.Text) < 1) Then


MessageBox.Show("Escriba los Apellidos.Actualización cancelada",
"Faltan datos", 0, MessageBoxIcon.Information)
txtTipo.Focus()
Return False
End If

s = "SELECT total=Count(cod_Estudiante) FROM Estudiante WHERE


(Ape_Estudiante='" & txtApellidos.Text & "')"
s = s & " AND (nom_alumno = '" & txtNombres.Text & "')"
If Me.Text = spModificacion Then
s = s & " AND NOT (cod_Alumno='" & txtCodigo.Text & "')"
End If
If (CountRegistros("total", s) > 0) Then
MessageBox.Show("Ese nombre ya existe en la BD.Actualización
cancelada", "Faltan datos", 0, MessageBoxIcon.Information)
txtNombres.Focus()
Return False
End If
If Me.Text = spNuevo Then
s = "SELECT total=Count(cod_Estudiante) FROM Estudiante WHERE
(cod_Estudiante='" & txtCodigo.Text & "')"
If (CountRegistros("total", s) > 0) Then GeneraCodigo()
End If
Return True
End Function

Private Function ActualizarBaseDeDatos(ByVal IsInsercion As Boolean) As


Boolean
Dim oCNN As System.Data.SqlClient.SqlConnection
Dim oCMD As System.Data.SqlClient.SqlCommand
Dim oPRM As System.Data.SqlClient.SqlParameter
Dim Codigo As Integer
Dim r As Boolean
Codigo = 0
r = True
' oCNN = Conector.NewConexion()
' oCNN.Open()
oCNN = MODCONEXION.Conexion
If IsInsercion Then
GeneraCodigo()
oCMD = NewComando(oCNN, "dbo.InsertEstudiante",
CommandType.StoredProcedure)
Else
oCMD = NewComando(oCNN, "dbo.ActualizarEstudiante",
CommandType.StoredProcedure)
End If
oPRM = NewParameter("Nom_Estudiante", True, SqlDbType.VarChar, 20,
txtNombres.Text)
oCMD.Parameters.Add(oPRM)
oPRM = NewParameter("Ape_Estudiante", True, SqlDbType.VarChar, 20,
txtApellidos.Text)
oCMD.Parameters.Add(oPRM)
oPRM = NewParameter("Fecha_Ingreso", True, SqlDbType.DateTime, 8,
txtFechaIngreso.Text)
oCMD.Parameters.Add(oPRM)
oPRM = NewParameter("Tipo_Estudiante", True, SqlDbType.Char, 18,
txtTipo.Text)
oCMD.Parameters.Add(oPRM)
oPRM = NewParameter("Cod_Estudiante", True, SqlDbType.Char, 18,
txtCodigo.Text)
oCMD.Parameters.Add(oPRM)

Try
oCNN.Open()
oCMD.ExecuteNonQuery()
Catch xErr As Exception
MsgBox(xErr.Message)
r = False
Finally
oCNN.Close()
oCMD = Nothing
oPRM = Nothing
oCNN = Nothing
End Try
Return r
End Function
Protected Overrides Sub Finalize()
MyBase.Finalize()
End Sub

Private Sub frmActEstudiante_Closed(ByVal sender As Object, ByVal e As


System.EventArgs) Handles MyBase.Closed
MODCONEXION.FRMAA = False
End Sub

End Class
Materias

Imports System.Data.SqlClient
Public Class frmActMateria
Inherits System.Windows.Forms.Form
Dim daCurso As SqlDataAdapter
Dim daEspecialidad As SqlDataAdapter
Dim daTeoria As SqlDataAdapter
Dim objDataSet As DataSet
Dim flag As Integer
Dim resultado As Integer
Dim strCodigo As String

Const spExploracion = "Materia: Exploración de registros"


Const spNuevo = "Materia: Nuevo Registro"
Const spModificacion = "Materia: Modificación del Registro"
Dim SQLAdapter_Master As SqlDataAdapter
Dim DataSet_Master As DataSet
#Region " Código generado por el Diseñador de Windows Forms "
Public Sub New()
MyBase.New()

'El Diseñador de Windows Forms requiere esta llamada.


InitializeComponent()

'Agregar cualquier inicialización después de la llamada a


InitializeComponent()

End Sub

'Form reemplaza a Dispose para limpiar la lista de componentes.


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Requerido por el Diseñador de Windows Forms


Private components As System.ComponentModel.IContainer

'NOTA: el Diseñador de Windows Forms requiere el siguiente procedimiento


'Puede modificarse utilizando el Diseñador de Windows Forms.
'No lo modifique con el editor de código.
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label7 As System.Windows.Forms.Label
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents cboCodEspecialidad As System.Windows.Forms.ComboBox
Friend WithEvents txtCodigo As System.Windows.Forms.TextBox
Friend WithEvents txtNom_Materia As System.Windows.Forms.TextBox
Friend WithEvents cboId_Teoria As System.Windows.Forms.ComboBox
Friend WithEvents lblRegistro As System.Windows.Forms.Label
Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
Friend WithEvents btnBuscar As System.Windows.Forms.Button
Friend WithEvents btnSalir As System.Windows.Forms.Button
Friend WithEvents btnEliminar As System.Windows.Forms.Button
Friend WithEvents btnCancelar As System.Windows.Forms.Button
Friend WithEvents btnGuardar As System.Windows.Forms.Button
Friend WithEvents btnEditar As System.Windows.Forms.Button
Friend WithEvents btnNuevo As System.Windows.Forms.Button
Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents btnUltimo As System.Windows.Forms.Button
Friend WithEvents btnSiguiente As System.Windows.Forms.Button
Friend WithEvents btnAnterior As System.Windows.Forms.Button
Friend WithEvents btnPrimero As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.ComponentModel.ComponentResourceManager = New
System.ComponentModel.ComponentResourceManager(GetType(frmActMateria))
Me.Label3 = New System.Windows.Forms.Label
Me.txtNom_Materia = New System.Windows.Forms.TextBox
Me.cboCodEspecialidad = New System.Windows.Forms.ComboBox
Me.Label2 = New System.Windows.Forms.Label
Me.cboId_Teoria = New System.Windows.Forms.ComboBox
Me.Label7 = New System.Windows.Forms.Label
Me.Label1 = New System.Windows.Forms.Label
Me.txtCodigo = New System.Windows.Forms.TextBox
Me.lblRegistro = New System.Windows.Forms.Label
Me.GroupBox2 = New System.Windows.Forms.GroupBox
Me.btnBuscar = New System.Windows.Forms.Button
Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
Me.btnSalir = New System.Windows.Forms.Button
Me.btnEliminar = New System.Windows.Forms.Button
Me.btnCancelar = New System.Windows.Forms.Button
Me.btnGuardar = New System.Windows.Forms.Button
Me.btnEditar = New System.Windows.Forms.Button
Me.btnNuevo = New System.Windows.Forms.Button
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.btnUltimo = New System.Windows.Forms.Button
Me.btnSiguiente = New System.Windows.Forms.Button
Me.btnAnterior = New System.Windows.Forms.Button
Me.btnPrimero = New System.Windows.Forms.Button
Me.GroupBox2.SuspendLayout()
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'Label3
'
Me.Label3.BackColor = System.Drawing.Color.Transparent
Me.Label3.Font = New System.Drawing.Font("Comic Sans MS", 9.75!,
CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline),
System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label3.ForeColor = System.Drawing.Color.Blue
Me.Label3.Location = New System.Drawing.Point(16, 80)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(152, 23)
Me.Label3.TabIndex = 101
Me.Label3.Text = "Nombre Materia:"
'
'txtNom_Materia
'
Me.txtNom_Materia.Font = New System.Drawing.Font("Microsoft Sans
Serif", 8.25!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtNom_Materia.ForeColor = System.Drawing.Color.Navy
Me.txtNom_Materia.Location = New System.Drawing.Point(168, 80)
Me.txtNom_Materia.Name = "txtNom_Materia"
Me.txtNom_Materia.Size = New System.Drawing.Size(184, 20)
Me.txtNom_Materia.TabIndex = 100
'
'cboCodEspecialidad
'
Me.cboCodEspecialidad.Font = New System.Drawing.Font("Microsoft Sans
Serif", 8.25!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.cboCodEspecialidad.ForeColor = System.Drawing.Color.Navy
Me.cboCodEspecialidad.Location = New System.Drawing.Point(200, 112)
Me.cboCodEspecialidad.Name = "cboCodEspecialidad"
Me.cboCodEspecialidad.Size = New System.Drawing.Size(121, 21)
Me.cboCodEspecialidad.TabIndex = 99
'
'Label2
'
Me.Label2.BackColor = System.Drawing.Color.Transparent
Me.Label2.Font = New System.Drawing.Font("Comic Sans MS", 9.75!,
CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline),
System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label2.ForeColor = System.Drawing.Color.Blue
Me.Label2.Location = New System.Drawing.Point(16, 112)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(176, 23)
Me.Label2.TabIndex = 98
Me.Label2.Text = "Codigo de la Especialidad:"
'
'cboId_Teoria
'
Me.cboId_Teoria.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.cboId_Teoria.ForeColor = System.Drawing.Color.Navy
Me.cboId_Teoria.Location = New System.Drawing.Point(200, 144)
Me.cboId_Teoria.Name = "cboId_Teoria"
Me.cboId_Teoria.Size = New System.Drawing.Size(121, 21)
Me.cboId_Teoria.TabIndex = 97
'
'Label7
'
Me.Label7.BackColor = System.Drawing.Color.Transparent
Me.Label7.Font = New System.Drawing.Font("Comic Sans MS", 9.75!,
CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline),
System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label7.ForeColor = System.Drawing.Color.Blue
Me.Label7.Location = New System.Drawing.Point(16, 144)
Me.Label7.Name = "Label7"
Me.Label7.Size = New System.Drawing.Size(120, 23)
Me.Label7.TabIndex = 96
Me.Label7.Text = "ID de Teoria:"
'
'Label1
'
Me.Label1.BackColor = System.Drawing.Color.Transparent
Me.Label1.Font = New System.Drawing.Font("Comic Sans MS", 9.75!,
CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline),
System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.ForeColor = System.Drawing.Color.Blue
Me.Label1.Location = New System.Drawing.Point(16, 24)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(152, 23)
Me.Label1.TabIndex = 95
Me.Label1.Text = "Codigo Materia:"
'
'txtCodigo
'
Me.txtCodigo.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.txtCodigo.ForeColor = System.Drawing.Color.Navy
Me.txtCodigo.Location = New System.Drawing.Point(184, 24)
Me.txtCodigo.Name = "txtCodigo"
Me.txtCodigo.Size = New System.Drawing.Size(80, 20)
Me.txtCodigo.TabIndex = 94
'
'lblRegistro
'
Me.lblRegistro.Font = New System.Drawing.Font("Times New Roman",
14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.lblRegistro.ForeColor = System.Drawing.Color.Blue
Me.lblRegistro.Location = New System.Drawing.Point(384, 32)
Me.lblRegistro.Name = "lblRegistro"
Me.lblRegistro.Size = New System.Drawing.Size(192, 24)
Me.lblRegistro.TabIndex = 104
Me.lblRegistro.Text = "Registro:"
'
'GroupBox2
'
Me.GroupBox2.BackColor = System.Drawing.Color.Transparent
Me.GroupBox2.Controls.Add(Me.btnBuscar)
Me.GroupBox2.Controls.Add(Me.btnSalir)
Me.GroupBox2.Controls.Add(Me.btnEliminar)
Me.GroupBox2.Controls.Add(Me.btnCancelar)
Me.GroupBox2.Controls.Add(Me.btnGuardar)
Me.GroupBox2.Controls.Add(Me.btnEditar)
Me.GroupBox2.Controls.Add(Me.btnNuevo)
Me.GroupBox2.Location = New System.Drawing.Point(24, 203)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(600, 56)
Me.GroupBox2.TabIndex = 102
Me.GroupBox2.TabStop = False
'
'btnBuscar
'
Me.btnBuscar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnBuscar.ForeColor = System.Drawing.Color.Red
Me.btnBuscar.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnBuscar.ImageIndex = 7
Me.btnBuscar.ImageList = Me.ImageList1
Me.btnBuscar.Location = New System.Drawing.Point(344, 16)
Me.btnBuscar.Name = "btnBuscar"
Me.btnBuscar.Size = New System.Drawing.Size(80, 24)
Me.btnBuscar.TabIndex = 6
Me.btnBuscar.Text = "&Buscar"
'
'ImageList1
'
Me.ImageList1.ImageStream =
CType(resources.GetObject("ImageList1.ImageStream"),
System.Windows.Forms.ImageListStreamer)
Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent
Me.ImageList1.Images.SetKeyName(0, "")
Me.ImageList1.Images.SetKeyName(1, "")
Me.ImageList1.Images.SetKeyName(2, "")
Me.ImageList1.Images.SetKeyName(3, "")
Me.ImageList1.Images.SetKeyName(4, "")
Me.ImageList1.Images.SetKeyName(5, "")
Me.ImageList1.Images.SetKeyName(6, "")
Me.ImageList1.Images.SetKeyName(7, "")
Me.ImageList1.Images.SetKeyName(8, "")
Me.ImageList1.Images.SetKeyName(9, "")
Me.ImageList1.Images.SetKeyName(10, "")
Me.ImageList1.Images.SetKeyName(11, "")
Me.ImageList1.Images.SetKeyName(12, "")
Me.ImageList1.Images.SetKeyName(13, "")
Me.ImageList1.Images.SetKeyName(14, "")
'
'btnSalir
'
Me.btnSalir.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnSalir.ForeColor = System.Drawing.Color.Red
Me.btnSalir.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnSalir.ImageIndex = 6
Me.btnSalir.ImageList = Me.ImageList1
Me.btnSalir.Location = New System.Drawing.Point(504, 16)
Me.btnSalir.Name = "btnSalir"
Me.btnSalir.Size = New System.Drawing.Size(80, 24)
Me.btnSalir.TabIndex = 5
Me.btnSalir.Text = "&Salir"
'
'btnEliminar
'
Me.btnEliminar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnEliminar.ForeColor = System.Drawing.Color.Red
Me.btnEliminar.ImageAlign =
System.Drawing.ContentAlignment.MiddleRight
Me.btnEliminar.ImageList = Me.ImageList1
Me.btnEliminar.Location = New System.Drawing.Point(432, 16)
Me.btnEliminar.Name = "btnEliminar"
Me.btnEliminar.Size = New System.Drawing.Size(64, 24)
Me.btnEliminar.TabIndex = 4
Me.btnEliminar.Text = "&Eliminar"
'
'btnCancelar
'
Me.btnCancelar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnCancelar.ForeColor = System.Drawing.Color.Red
Me.btnCancelar.ImageList = Me.ImageList1
Me.btnCancelar.Location = New System.Drawing.Point(272, 16)
Me.btnCancelar.Name = "btnCancelar"
Me.btnCancelar.Size = New System.Drawing.Size(64, 24)
Me.btnCancelar.TabIndex = 3
Me.btnCancelar.Text = "&Cancelar"
'
'btnGuardar
'
Me.btnGuardar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnGuardar.ForeColor = System.Drawing.Color.Red
Me.btnGuardar.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnGuardar.ImageIndex = 10
Me.btnGuardar.ImageList = Me.ImageList1
Me.btnGuardar.Location = New System.Drawing.Point(176, 16)
Me.btnGuardar.Name = "btnGuardar"
Me.btnGuardar.Size = New System.Drawing.Size(88, 24)
Me.btnGuardar.TabIndex = 2
Me.btnGuardar.Text = "&Guardar"
'
'btnEditar
'
Me.btnEditar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnEditar.ForeColor = System.Drawing.Color.Red
Me.btnEditar.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnEditar.ImageList = Me.ImageList1
Me.btnEditar.Location = New System.Drawing.Point(104, 16)
Me.btnEditar.Name = "btnEditar"
Me.btnEditar.Size = New System.Drawing.Size(64, 24)
Me.btnEditar.TabIndex = 1
Me.btnEditar.Text = "&Editar"
'
'btnNuevo
'
Me.btnNuevo.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnNuevo.ForeColor = System.Drawing.Color.Red
Me.btnNuevo.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnNuevo.ImageIndex = 14
Me.btnNuevo.ImageList = Me.ImageList1
Me.btnNuevo.Location = New System.Drawing.Point(8, 16)
Me.btnNuevo.Name = "btnNuevo"
Me.btnNuevo.Size = New System.Drawing.Size(80, 24)
Me.btnNuevo.TabIndex = 0
Me.btnNuevo.Text = "&Nuevo"
'
'GroupBox1
'
Me.GroupBox1.BackColor = System.Drawing.Color.Transparent
Me.GroupBox1.Controls.Add(Me.btnUltimo)
Me.GroupBox1.Controls.Add(Me.btnSiguiente)
Me.GroupBox1.Controls.Add(Me.btnAnterior)
Me.GroupBox1.Controls.Add(Me.btnPrimero)
Me.GroupBox1.ForeColor = System.Drawing.SystemColors.ActiveCaption
Me.GroupBox1.Location = New System.Drawing.Point(384, 80)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(240, 88)
Me.GroupBox1.TabIndex = 103
Me.GroupBox1.TabStop = False
'
'btnUltimo
'
Me.btnUltimo.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnUltimo.ForeColor = System.Drawing.Color.Navy
Me.btnUltimo.Location = New System.Drawing.Point(128, 56)
Me.btnUltimo.Name = "btnUltimo"
Me.btnUltimo.Size = New System.Drawing.Size(96, 23)
Me.btnUltimo.TabIndex = 3
Me.btnUltimo.Text = " &Ultimo >>"
'
'btnSiguiente
'
Me.btnSiguiente.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnSiguiente.ForeColor = System.Drawing.Color.Navy
Me.btnSiguiente.Location = New System.Drawing.Point(128, 16)
Me.btnSiguiente.Name = "btnSiguiente"
Me.btnSiguiente.Size = New System.Drawing.Size(96, 24)
Me.btnSiguiente.TabIndex = 2
Me.btnSiguiente.Text = " &Siguiente >>"
'
'btnAnterior
'
Me.btnAnterior.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnAnterior.ForeColor = System.Drawing.Color.Navy
Me.btnAnterior.Location = New System.Drawing.Point(16, 56)
Me.btnAnterior.Name = "btnAnterior"
Me.btnAnterior.Size = New System.Drawing.Size(88, 24)
Me.btnAnterior.TabIndex = 1
Me.btnAnterior.Text = "<< &Anterior"
'
'btnPrimero
'
Me.btnPrimero.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnPrimero.ForeColor = System.Drawing.Color.Navy
Me.btnPrimero.Location = New System.Drawing.Point(16, 16)
Me.btnPrimero.Name = "btnPrimero"
Me.btnPrimero.Size = New System.Drawing.Size(88, 23)
Me.btnPrimero.TabIndex = 0
Me.btnPrimero.Text = "<< &Primero"
'
'frmActMateria
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.Color.Gray
Me.ClientSize = New System.Drawing.Size(648, 310)
Me.Controls.Add(Me.GroupBox2)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.txtNom_Materia)
Me.Controls.Add(Me.cboCodEspecialidad)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.cboId_Teoria)
Me.Controls.Add(Me.Label7)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.txtCodigo)
Me.Controls.Add(Me.lblRegistro)
Me.Name = "frmActMateria"
Me.Text = "frmActMateria"
Me.GroupBox2.ResumeLayout(False)
Me.GroupBox1.ResumeLayout(False)
Me.ResumeLayout(False)
Me.PerformLayout()

End Sub

#End Region

Private Sub ConfiguraControles(ByVal stStatus As Integer)


txtCodigo.Enabled = (stStatus = 1)
txtNom_Materia.Enabled = (stStatus = 1) Or (stStatus = 2)
cboCodEspecialidad.Enabled = (stStatus = 1) Or (stStatus = 2)
cboId_Teoria.Enabled = (stStatus = 1) Or (stStatus = 2)

Select Case stStatus


Case 1 'Agregando nuevo registro
Me.Text = spNuevo
txtCodigo.Text = ""
txtNom_Materia.Text = ""
cboCodEspecialidad.Text = ""
cboId_Teoria.Text = ""
txtNom_Materia.Focus()
Case 2 'Modificando registro
Me.Text = spModificacion
txtNom_Materia.Focus()
Case Else ' Exploracion de datos
Me.Text = spExploracion
End Select
End Sub

Private Sub frmActCurso_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load
MODCONEXION.Conexion.Open()
daCurso = New SqlDataAdapter("Select * From Materia",
MODCONEXION.Conexion)
daEspecialidad = New SqlDataAdapter("Select * From Especialidad",
MODCONEXION.Conexion)
daTeoria = New SqlDataAdapter("Select * From Teoria",
MODCONEXION.Conexion)

objDataSet = New DataSet()


daCurso.Fill(objDataSet, "Materia")
daEspecialidad.Fill(objDataSet, "Especialidad")
daTeoria.Fill(objDataSet, "Teoria")
MODCONEXION.Conexion.Close()

Me.txtCodigo.DataBindings.Add("Text", objDataSet,
"Materia.Cod_Materia")
Me.txtNom_Materia.DataBindings.Add("Text", objDataSet,
"Materia.Nom_Materia")

Me.cboCodEspecialidad.DataBindings.Add(New
System.Windows.Forms.Binding("SelectedValue", Me.objDataSet,
"Materia.Cod_Especialidad"))
Me.cboCodEspecialidad.DataSource =
Me.objDataSet.Tables("Especialidad")
Me.cboCodEspecialidad.DisplayMember = "Nom_Especialidad"
Me.cboCodEspecialidad.ValueMember = "Cod_Especialidad"
Me.cboCodEspecialidad.DropDownStyle = ComboBoxStyle.DropDownList

Me.cboId_Teoria.DataBindings.Add(New
System.Windows.Forms.Binding("SelectedValue", Me.objDataSet,
"Materia.ID_Teoria"))
Me.cboId_Teoria.DataSource = Me.objDataSet.Tables("Teoria")
Me.cboId_Teoria.DisplayMember = "Horas"
Me.cboId_Teoria.ValueMember = "ID_Teoria"
Me.cboId_Teoria.DropDownStyle = ComboBoxStyle.DropDownList

Call HabilitarControles(True)
Call HabilitarBotones(True)
Call BotonA(True)
Call BotonB(True)

ConfiguraControles(0)
End Sub

Private Sub btnPrimero_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnPrimero.Click
Me.BindingContext(Me.objDataSet, "Materia").Position = 0
Call BotonA(False)
Call BotonB(True)
Call NumRegistro()
End Sub

Private Sub btnSiguiente_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnSiguiente.Click
If Me.BindingContext(objDataSet, "Materia").Position <
(Me.BindingContext(objDataSet, _
"Curso").Count - 1) Then
Me.BindingContext(objDataSet, "Materia").Position = _
(Me.BindingContext(objDataSet, "Materia").Position + 1)
Call BotonA(True)
Else
Call BotonB(False)
End If
Me.NumRegistro()
End Sub

Private Sub btnAnterior_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnAnterior.Click
If Me.BindingContext(objDataSet, "Materia").Position > 0 Then
Me.BindingContext(objDataSet, "Materia").Position = _
(Me.BindingContext(objDataSet, "Materia").Position - 1)
Call BotonB(True)
Else
Call BotonA(False)
End If
Me.NumRegistro()
End Sub

Private Sub btnUltimo_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnUltimo.Click
Me.BindingContext(Me.objDataSet, "Materia").Position = _
(Me.objDataSet.Tables("Materia").Rows.Count - 1)
Call BotonB(False)
Call BotonA(True)
Me.NumRegistro()
End Sub

Private Sub btnBuscar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnBuscar.Click
Dim strDato As String
Dim fila As Integer
Dim dv As New DataView()
strDato = InputBox("Ingrese codigo de Materia", "Buscar")
dv.Table = objDataSet.Tables("Curso")
dv.Sort = "Cod_Materia"
fila = dv.Find(strDato)
If fila = -1 Then
MessageBox.Show("Codigo de Materia no existe", "Cuidado")
Exit Sub
End If
Me.BindingContext(objDataSet, "Materia").Position = fila
Call NumRegistro()
End Sub

Private Sub btnNuevo_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnNuevo.Click
flag = 1
Call HabilitarControles(True)
Call HabilitarBotones(False)
Call LimpiarControles()

ConfiguraControles(1)
txtNom_Materia.Focus()
End Sub

Private Sub btnEditar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnEditar.Click
flag = 2
Call HabilitarControles(True)
Call HabilitarBotones(False)
ConfiguraControles(2)
End Sub

Private Sub btnGuardar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnGuardar.Click
Dim sql, oper As String
If flag = 1 Then ' Nuevo
sql = "INSERT INTO Materia(Cod_Curso, Nom_Materia,
Cod_Especialidad, ID_Teoria) VALUES (@Cod_Materia, @Nom_Materia,
@Cod_Especialidad, @ID_Teoria)"
oper = " insertados: "
Else ' Editar
sql = "UPDATE Materia SET Cod_Materia=@Cod_Materia,
Nom_Materia=@Nom_Materia, Cod_Especialidad=@Cod_Especialidad,
ID_Teoria=@ID_Teoria where Cod_Materia=@Cod_Materia"
oper = " modificados: "
End If
'Creando comando
Dim objcomando As New SqlCommand(sql, MODCONEXION.Conexion)
Try
objcomando.Parameters.Add(New SqlParameter("@Cod_Materia",
SqlDbType.Char))
objcomando.Parameters("@Cod_Materia").Value = txtCodigo.Text

objcomando.Parameters.Add(New SqlParameter("@Nom_Curso",
SqlDbType.VarChar))
objcomando.Parameters("@Nom_Materia").Value = txtNom_Materia.Text

objcomando.Parameters.Add(New SqlParameter("@Cod_Especialidad",
SqlDbType.Char))
objcomando.Parameters("@Cod_Especialidad").Value =
cboCodEspecialidad.SelectedValue

objcomando.Parameters.Add(New SqlParameter("@Id_Teoria",
SqlDbType.Char))
objcomando.Parameters("@Id_Teoria").Value =
cboId_Teoria.SelectedValue

MODCONEXION.Conexion.Open()
resultado = objcomando.ExecuteNonQuery
'Ejecuta una instrucción de Transact-SQL en Connection y devuelve
el número de filas afectadas.
Call Actualizar()
'Para actualizar posición
Call NumRegistro()
MessageBox.Show("Registros " & oper & resultado, "", 0,
MessageBoxIcon.Information)
Catch exc As Exception
MessageBox.Show(exc.Message)
End Try
Call HabilitarControles(True)
Call HabilitarBotones(True)
Call BotonA(True)
Call BotonB(True)
MODCONEXION.Conexion.Close()
End Sub

Private Sub btnCancelar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnCancelar.Click
MODCONEXION.Conexion.Open()
objDataSet.RejectChanges()
MODCONEXION.Conexion.Close()
btnAnterior.PerformClick()
Call HabilitarControles(False)
Call HabilitarBotones(True)
End Sub

Private Sub btnSalir_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnSalir.Click
MODCONEXION.Conexion.Close()
Me.Close()
End Sub

Private Sub HabilitarControles(ByVal est As Boolean)

Dim ctrl As Control


For Each ctrl In Me.Controls
If TypeOf ctrl Is TextBox Then ctrl.Enabled = est
Next
cboCodEspecialidad.Enabled = est
cboId_Teoria.Enabled = est
End Sub

Private Sub HabilitarBotones(ByVal est As Boolean)


Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeOf ctrl Is Button Then ctrl.Enabled = est
Next
btnGuardar.Enabled = Not est
btnCancelar.Enabled = Not est
End Sub

Private Sub LimpiarControles()


Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeOf ctrl Is TextBox Then ctrl.Text = ""
Next
End Sub

Private Sub NumRegistro()


Dim num, total As Integer
num = Me.BindingContext(objDataSet, "Materia").Position + 1
total = Me.objDataSet.Tables("Materia").Rows.Count
Me.lblRegistro.Text = "Reg: " & Str(num) & " de " & Str(total)
End Sub

Private Sub Actualizar()


objDataSet.Clear()
daCurso.Fill(objDataSet, "Ciclo")
daEspecialidad.Fill(objDataSet, "Materia")
daTeoria.Fill(objDataSet, "Periodo_Academico")
End Sub

Private Sub BotonB(ByVal VarX As Boolean)


btnSiguiente.Enabled = VarX
btnUltimo.Enabled = VarX
End Sub
Private Sub BotonA(ByVal VarX As Boolean)
btnPrimero.Enabled = VarX
btnAnterior.Enabled = VarX
End Sub

Private Sub btnEliminar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnEliminar.Click
Dim sql3 As String
sql3 = "delete from Ciclo where Cod_Materia=@Cod_Curso"
Dim objComando As New SqlCommand(sql3, MODCONEXION.Conexion)
Try
objComando.Parameters.Add(New SqlParameter("@Cod_Materia",
SqlDbType.VarChar))
objComando.Parameters("@Cod_Curso").Value = InputBox("Ingrese el
código del Materia a eliminar: ")
MODCONEXION.Conexion.Open()
resultado = objComando.ExecuteNonQuery
Call Actualizar()
btnAnterior.PerformClick() ' Para que muestre el registro anterior
luego de eliminar
MessageBox.Show("Registros Eliminados: " & resultado, "", 0,
MessageBoxIcon.Information)
Catch exc As Exception
MessageBox.Show(exc.Message)
End Try
MODCONEXION.Conexion.Close()
Call HabilitarControles(False)
Call HabilitarBotones(True)
Call BotonA(True)
Call BotonB(True)
End Sub
Private Sub frmActCurso_Closed(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Closed
MODCONEXION.FRMACU = False
End Sub

Private Sub GeneraCodigo()


Dim cmd As New SqlCommand("select max(Cod_Materia)from Materia",
MODCONEXION.Conexion)
MODCONEXION.Conexion.Open()
strCodigo = cmd.ExecuteScalar
MODCONEXION.Conexion.Close()
txtCodigo.Text = Format(Val(strCodigo) + 1, "00000")
End Sub

Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Label2.Click

End Sub

Private Sub lblRegistro_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles lblRegistro.Click

End Sub
End Class
Semestres.

Imports System.Data.SqlClient
Public Class frmActSemestre
Inherits System.Windows.Forms.Form
Dim daSemestre As SqlDataAdapter
Dim objDataSet As DataSet
Dim flag As Integer
Dim resultado As Integer
Dim strCodigo As String
#Region " Código generado por el Diseñador de Windows Forms "

Public Sub New()


MyBase.New()

'El Diseñador de Windows Forms requiere esta llamada.


InitializeComponent()

'Agregar cualquier inicialización después de la llamada a


InitializeComponent()

End Sub

'Form reemplaza a Dispose para limpiar la lista de componentes.


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Requerido por el Diseñador de Windows Forms


Private components As System.ComponentModel.IContainer

'NOTA: el Diseñador de Windows Forms requiere el siguiente procedimiento


'Puede modificarse utilizando el Diseñador de Windows Forms.
'No lo modifique con el editor de código.
Friend WithEvents txtFechaInicio As System.Windows.Forms.TextBox
Friend WithEvents Label7 As System.Windows.Forms.Label
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents txtFechaTermino As System.Windows.Forms.TextBox
Friend WithEvents txtSemestre As System.Windows.Forms.TextBox
Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
Friend WithEvents btnBuscar As System.Windows.Forms.Button
Friend WithEvents btnSalir As System.Windows.Forms.Button
Friend WithEvents btnEliminar As System.Windows.Forms.Button
Friend WithEvents btnCancelar As System.Windows.Forms.Button
Friend WithEvents btnGuardar As System.Windows.Forms.Button
Friend WithEvents btnEditar As System.Windows.Forms.Button
Friend WithEvents btnNuevo As System.Windows.Forms.Button
Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
Friend WithEvents lblRegistro As System.Windows.Forms.Label
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents btnUltimo As System.Windows.Forms.Button
Friend WithEvents btnSiguiente As System.Windows.Forms.Button
Friend WithEvents btnAnterior As System.Windows.Forms.Button
Friend WithEvents btnPrimero As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.ComponentModel.ComponentResourceManager = New
System.ComponentModel.ComponentResourceManager(GetType(frmActSemestre))
Me.txtFechaInicio = New System.Windows.Forms.TextBox
Me.Label7 = New System.Windows.Forms.Label
Me.Label5 = New System.Windows.Forms.Label
Me.Label1 = New System.Windows.Forms.Label
Me.txtFechaTermino = New System.Windows.Forms.TextBox
Me.txtSemestre = New System.Windows.Forms.TextBox
Me.GroupBox2 = New System.Windows.Forms.GroupBox
Me.btnBuscar = New System.Windows.Forms.Button
Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
Me.btnSalir = New System.Windows.Forms.Button
Me.btnEliminar = New System.Windows.Forms.Button
Me.btnCancelar = New System.Windows.Forms.Button
Me.btnGuardar = New System.Windows.Forms.Button
Me.btnEditar = New System.Windows.Forms.Button
Me.btnNuevo = New System.Windows.Forms.Button
Me.lblRegistro = New System.Windows.Forms.Label
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.btnUltimo = New System.Windows.Forms.Button
Me.btnSiguiente = New System.Windows.Forms.Button
Me.btnAnterior = New System.Windows.Forms.Button
Me.btnPrimero = New System.Windows.Forms.Button
Me.GroupBox2.SuspendLayout()
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'txtFechaInicio
'
Me.txtFechaInicio.Font = New System.Drawing.Font("Microsoft Sans
Serif", 8.25!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtFechaInicio.ForeColor = System.Drawing.Color.Navy
Me.txtFechaInicio.Location = New System.Drawing.Point(176, 88)
Me.txtFechaInicio.Name = "txtFechaInicio"
Me.txtFechaInicio.Size = New System.Drawing.Size(152, 20)
Me.txtFechaInicio.TabIndex = 73
'
'Label7
'
Me.Label7.BackColor = System.Drawing.Color.Transparent
Me.Label7.Font = New System.Drawing.Font("Comic Sans MS", 9.75!,
CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline),
System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label7.ForeColor = System.Drawing.Color.Blue
Me.Label7.Location = New System.Drawing.Point(8, 88)
Me.Label7.Name = "Label7"
Me.Label7.Size = New System.Drawing.Size(168, 24)
Me.Label7.TabIndex = 72
Me.Label7.Text = "Fecha de Inicio:"
'
'Label5
'
Me.Label5.BackColor = System.Drawing.Color.Transparent
Me.Label5.Font = New System.Drawing.Font("Comic Sans MS", 9.75!,
CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline),
System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label5.ForeColor = System.Drawing.Color.Blue
Me.Label5.Location = New System.Drawing.Point(8, 120)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(144, 24)
Me.Label5.TabIndex = 71
Me.Label5.Text = "Fecha de Termino:"
'
'Label1
'
Me.Label1.BackColor = System.Drawing.Color.Transparent
Me.Label1.Font = New System.Drawing.Font("Comic Sans MS", 9.75!,
CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline),
System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.ForeColor = System.Drawing.Color.Blue
Me.Label1.Location = New System.Drawing.Point(8, 48)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(64, 23)
Me.Label1.TabIndex = 68
Me.Label1.Text = "Semestre:"
'
'txtFechaTermino
'
Me.txtFechaTermino.Font = New System.Drawing.Font("Microsoft Sans
Serif", 8.25!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtFechaTermino.ForeColor = System.Drawing.Color.Navy
Me.txtFechaTermino.Location = New System.Drawing.Point(176, 120)
Me.txtFechaTermino.Name = "txtFechaTermino"
Me.txtFechaTermino.Size = New System.Drawing.Size(152, 20)
Me.txtFechaTermino.TabIndex = 67
'
'txtSemestre
'
Me.txtSemestre.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.txtSemestre.ForeColor = System.Drawing.Color.Navy
Me.txtSemestre.Location = New System.Drawing.Point(96, 48)
Me.txtSemestre.Name = "txtSemestre"
Me.txtSemestre.Size = New System.Drawing.Size(72, 20)
Me.txtSemestre.TabIndex = 64
'
'GroupBox2
'
Me.GroupBox2.BackColor = System.Drawing.Color.Transparent
Me.GroupBox2.Controls.Add(Me.btnBuscar)
Me.GroupBox2.Controls.Add(Me.btnSalir)
Me.GroupBox2.Controls.Add(Me.btnEliminar)
Me.GroupBox2.Controls.Add(Me.btnCancelar)
Me.GroupBox2.Controls.Add(Me.btnGuardar)
Me.GroupBox2.Controls.Add(Me.btnEditar)
Me.GroupBox2.Controls.Add(Me.btnNuevo)
Me.GroupBox2.Location = New System.Drawing.Point(8, 160)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(584, 56)
Me.GroupBox2.TabIndex = 99
Me.GroupBox2.TabStop = False
'
'btnBuscar
'
Me.btnBuscar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnBuscar.ForeColor = System.Drawing.Color.Red
Me.btnBuscar.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnBuscar.ImageIndex = 7
Me.btnBuscar.ImageList = Me.ImageList1
Me.btnBuscar.Location = New System.Drawing.Point(336, 16)
Me.btnBuscar.Name = "btnBuscar"
Me.btnBuscar.Size = New System.Drawing.Size(80, 24)
Me.btnBuscar.TabIndex = 6
Me.btnBuscar.Text = "&Buscar"
'
'ImageList1
'
Me.ImageList1.ImageStream =
CType(resources.GetObject("ImageList1.ImageStream"),
System.Windows.Forms.ImageListStreamer)
Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent
Me.ImageList1.Images.SetKeyName(0, "")
Me.ImageList1.Images.SetKeyName(1, "")
Me.ImageList1.Images.SetKeyName(2, "")
Me.ImageList1.Images.SetKeyName(3, "")
Me.ImageList1.Images.SetKeyName(4, "")
Me.ImageList1.Images.SetKeyName(5, "")
Me.ImageList1.Images.SetKeyName(6, "")
Me.ImageList1.Images.SetKeyName(7, "")
Me.ImageList1.Images.SetKeyName(8, "")
Me.ImageList1.Images.SetKeyName(9, "")
Me.ImageList1.Images.SetKeyName(10, "")
Me.ImageList1.Images.SetKeyName(11, "")
Me.ImageList1.Images.SetKeyName(12, "")
Me.ImageList1.Images.SetKeyName(13, "")
Me.ImageList1.Images.SetKeyName(14, "")
'
'btnSalir
'
Me.btnSalir.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnSalir.ForeColor = System.Drawing.Color.Red
Me.btnSalir.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnSalir.ImageIndex = 6
Me.btnSalir.ImageList = Me.ImageList1
Me.btnSalir.Location = New System.Drawing.Point(496, 16)
Me.btnSalir.Name = "btnSalir"
Me.btnSalir.Size = New System.Drawing.Size(80, 24)
Me.btnSalir.TabIndex = 5
Me.btnSalir.Text = "&Salir"
'
'btnEliminar
'
Me.btnEliminar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnEliminar.ForeColor = System.Drawing.Color.Red
Me.btnEliminar.ImageAlign =
System.Drawing.ContentAlignment.MiddleRight
Me.btnEliminar.ImageList = Me.ImageList1
Me.btnEliminar.Location = New System.Drawing.Point(424, 16)
Me.btnEliminar.Name = "btnEliminar"
Me.btnEliminar.Size = New System.Drawing.Size(64, 24)
Me.btnEliminar.TabIndex = 4
Me.btnEliminar.Text = "&Eliminar"
'
'btnCancelar
'
Me.btnCancelar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnCancelar.ForeColor = System.Drawing.Color.Red
Me.btnCancelar.ImageList = Me.ImageList1
Me.btnCancelar.Location = New System.Drawing.Point(264, 16)
Me.btnCancelar.Name = "btnCancelar"
Me.btnCancelar.Size = New System.Drawing.Size(64, 24)
Me.btnCancelar.TabIndex = 3
Me.btnCancelar.Text = "&Cancelar"
'
'btnGuardar
'
Me.btnGuardar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnGuardar.ForeColor = System.Drawing.Color.Red
Me.btnGuardar.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnGuardar.ImageIndex = 10
Me.btnGuardar.ImageList = Me.ImageList1
Me.btnGuardar.Location = New System.Drawing.Point(168, 16)
Me.btnGuardar.Name = "btnGuardar"
Me.btnGuardar.Size = New System.Drawing.Size(88, 24)
Me.btnGuardar.TabIndex = 2
Me.btnGuardar.Text = "&Guardar"
'
'btnEditar
'
Me.btnEditar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnEditar.ForeColor = System.Drawing.Color.Red
Me.btnEditar.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnEditar.ImageList = Me.ImageList1
Me.btnEditar.Location = New System.Drawing.Point(96, 16)
Me.btnEditar.Name = "btnEditar"
Me.btnEditar.Size = New System.Drawing.Size(64, 24)
Me.btnEditar.TabIndex = 1
Me.btnEditar.Text = "&Editar"
'
'btnNuevo
'
Me.btnNuevo.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnNuevo.ForeColor = System.Drawing.Color.Red
Me.btnNuevo.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnNuevo.ImageIndex = 14
Me.btnNuevo.ImageList = Me.ImageList1
Me.btnNuevo.Location = New System.Drawing.Point(8, 16)
Me.btnNuevo.Name = "btnNuevo"
Me.btnNuevo.Size = New System.Drawing.Size(80, 24)
Me.btnNuevo.TabIndex = 0
Me.btnNuevo.Text = "&Nuevo"
'
'lblRegistro
'
Me.lblRegistro.Font = New System.Drawing.Font("Times New Roman",
14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.lblRegistro.ForeColor = System.Drawing.Color.Blue
Me.lblRegistro.Location = New System.Drawing.Point(376, 16)
Me.lblRegistro.Name = "lblRegistro"
Me.lblRegistro.Size = New System.Drawing.Size(192, 24)
Me.lblRegistro.TabIndex = 101
Me.lblRegistro.Text = "Registro:"
'
'GroupBox1
'
Me.GroupBox1.BackColor = System.Drawing.Color.Transparent
Me.GroupBox1.Controls.Add(Me.btnUltimo)
Me.GroupBox1.Controls.Add(Me.btnSiguiente)
Me.GroupBox1.Controls.Add(Me.btnAnterior)
Me.GroupBox1.Controls.Add(Me.btnPrimero)
Me.GroupBox1.ForeColor = System.Drawing.SystemColors.ActiveCaption
Me.GroupBox1.Location = New System.Drawing.Point(376, 56)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(212, 88)
Me.GroupBox1.TabIndex = 100
Me.GroupBox1.TabStop = False
'
'btnUltimo
'
Me.btnUltimo.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnUltimo.ForeColor = System.Drawing.Color.Navy
Me.btnUltimo.Location = New System.Drawing.Point(104, 56)
Me.btnUltimo.Name = "btnUltimo"
Me.btnUltimo.Size = New System.Drawing.Size(96, 23)
Me.btnUltimo.TabIndex = 3
Me.btnUltimo.Text = " &Ultimo >>"
'
'btnSiguiente
'
Me.btnSiguiente.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnSiguiente.ForeColor = System.Drawing.Color.Navy
Me.btnSiguiente.Location = New System.Drawing.Point(104, 16)
Me.btnSiguiente.Name = "btnSiguiente"
Me.btnSiguiente.Size = New System.Drawing.Size(96, 24)
Me.btnSiguiente.TabIndex = 2
Me.btnSiguiente.Text = " &Siguiente >>"
'
'btnAnterior
'
Me.btnAnterior.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnAnterior.ForeColor = System.Drawing.Color.Navy
Me.btnAnterior.Location = New System.Drawing.Point(8, 56)
Me.btnAnterior.Name = "btnAnterior"
Me.btnAnterior.Size = New System.Drawing.Size(88, 24)
Me.btnAnterior.TabIndex = 1
Me.btnAnterior.Text = "<< &Anterior"
'
'btnPrimero
'
Me.btnPrimero.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnPrimero.ForeColor = System.Drawing.Color.Navy
Me.btnPrimero.Location = New System.Drawing.Point(8, 16)
Me.btnPrimero.Name = "btnPrimero"
Me.btnPrimero.Size = New System.Drawing.Size(88, 23)
Me.btnPrimero.TabIndex = 0
Me.btnPrimero.Text = "<< &Primero"
'
'frmActSemestre
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.Color.Gray
Me.ClientSize = New System.Drawing.Size(608, 246)
Me.Controls.Add(Me.lblRegistro)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.txtFechaInicio)
Me.Controls.Add(Me.Label7)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.txtFechaTermino)
Me.Controls.Add(Me.txtSemestre)
Me.Controls.Add(Me.GroupBox2)
Me.Name = "frmActSemestre"
Me.Text = "frmSemestre"
Me.GroupBox2.ResumeLayout(False)
Me.GroupBox1.ResumeLayout(False)
Me.ResumeLayout(False)
Me.PerformLayout()

End Sub

#End Region

Private Sub frmPeriodoAcademico_Load(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles MyBase.Load
MODCONEXION.Conexion.Open()
daSemestre = New SqlDataAdapter("select * from Semestre",
MODCONEXION.Conexion)
objDataSet = New DataSet()
daSemestre.Fill(objDataSet, "Semestre")
MODCONEXION.Conexion.Close()

Me.txtSemestre.DataBindings.Add("Text", objDataSet,
"Semestre.Semestre")
Me.txtFechaInicio.DataBindings.Add("Text", objDataSet,
"Semestre.Fecha_Inicio")
Me.txtFechaTermino.DataBindings.Add("Text", objDataSet,
"Semestre.Fecha_Termino")

Call HabilitarControles(True)
Call HabilitarBotones(True)
Call BotonA(True)
Call BotonB(True)

End Sub

Private Sub btnPrimero_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnPrimero.Click
Me.BindingContext(Me.objDataSet, "Semestre").Position = 0
Call BotonA(False)
Call BotonB(True)
Call NumRegistro()
End Sub

Private Sub btnSiguiente_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnSiguiente.Click
If Me.BindingContext(objDataSet, "Semestre").Position <
(Me.BindingContext(objDataSet, _
"Semestre").Count - 1) Then
Me.BindingContext(objDataSet, "Semestre").Position = _
(Me.BindingContext(objDataSet, "Semestre").Position + 1)
Call BotonA(True)
Else
Call BotonB(False)
End If
Me.NumRegistro()
End Sub

Private Sub btnAnterior_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnAnterior.Click
If Me.BindingContext(objDataSet, "Semestre").Position > 0 Then
Me.BindingContext(objDataSet, "Semestre").Position = _
(Me.BindingContext(objDataSet, "Semestre").Position - 1)
Call BotonB(True)
Else
Call BotonA(False)
End If
Me.NumRegistro()
End Sub

Private Sub btnUltimo_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnUltimo.Click
Me.BindingContext(Me.objDataSet, "Semestre").Position = _
(Me.objDataSet.Tables("Semestre").Rows.Count - 1)
Call BotonB(False)
Call BotonA(True)
Me.NumRegistro()
End Sub

Private Sub btnBuscar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnBuscar.Click
Dim strDato As String
Dim fila As Integer
Dim dv As New DataView()
strDato = InputBox("Ingrese codigo de Semestre", "Buscar")
dv.Table = objDataSet.Tables("Semestre")
dv.Sort = "Semestre"
fila = dv.Find(strDato)
If fila = -1 Then
MessageBox.Show("Codigo de Semestre no existe", "Cuidado")
Exit Sub
End If
Me.BindingContext(objDataSet, "Semestre").Position = fila
Call NumRegistro()
End Sub

Private Sub btnNuevo_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnNuevo.Click
flag = 1
Call HabilitarControles(True)
Call HabilitarBotones(False)
Call LimpiarControles()
Call GeneraCodigo()
txtSemestre.Focus()
End Sub

Private Sub btnEditar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnEditar.Click
flag = 2
Call HabilitarControles(True)
Call HabilitarBotones(False)
txtSemestre.Enabled = False
End Sub

Private Sub btnCancelar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnCancelar.Click
MODCONEXION.Conexion.Open()
objDataSet.RejectChanges()
MODCONEXION.Conexion.Close()
btnAnterior.PerformClick()
Call HabilitarControles(False)
Call HabilitarBotones(True)
End Sub

Private Sub btnSalir_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnSalir.Click
MODCONEXION.Conexion.Close()
Me.Close()
End Sub

Private Sub HabilitarControles(ByVal est As Boolean)

Dim ctrl As Control


For Each ctrl In Me.Controls
If TypeOf ctrl Is TextBox Then ctrl.Enabled = est
Next

End Sub

Private Sub HabilitarBotones(ByVal est As Boolean)


Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeOf ctrl Is Button Then ctrl.Enabled = est
Next
btnGuardar.Enabled = Not est
btnCancelar.Enabled = Not est
End Sub

Private Sub LimpiarControles()


Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeOf ctrl Is TextBox Then ctrl.Text = ""
Next
End Sub

Private Sub Actualizar()


objDataSet.Clear()
daSemestre.Fill(objDataSet, "Semestre")
End Sub

Private Sub GeneraCodigo()


Dim cmd As New SqlCommand("select max(Semestre)from Semestre",
MODCONEXION.Conexion)
MODCONEXION.Conexion.Open()
strCodigo = cmd.ExecuteScalar
MODCONEXION.Conexion.Close()
txtSemestre.Text = Format(Val(strCodigo) + 1, "00000")
End Sub

Private Sub BotonB(ByVal VarX As Boolean)


btnSiguiente.Enabled = VarX
btnUltimo.Enabled = VarX
End Sub

Private Sub BotonA(ByVal VarX As Boolean)


btnPrimero.Enabled = VarX
btnAnterior.Enabled = VarX
End Sub

Private Sub btnEliminar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnEliminar.Click
Dim sql3 As String
sql3 = "delete from Semestre where Semestre=@Semestre"
Dim objComando As New SqlCommand(sql3, MODCONEXION.Conexion)
Try
objComando.Parameters.Add(New SqlParameter("@Semestre",
SqlDbType.VarChar))
objComando.Parameters("@Semestre").Value = InputBox("Ingrese el
código del Semestre a eliminar: ")
MODCONEXION.Conexion.Open()
resultado = objComando.ExecuteNonQuery
Call Actualizar()
btnAnterior.PerformClick() ' Para que muestre el registro anterior
luego de eliminar
MessageBox.Show("Registros Eliminados: " & resultado, "", 0,
MessageBoxIcon.Information)
Catch exc As Exception
MessageBox.Show(exc.Message)
End Try
MODCONEXION.Conexion.Close()
Call HabilitarControles(False)
Call HabilitarBotones(True)
Call BotonA(True)
Call BotonB(True)
End Sub

Private Sub btnGuardar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnGuardar.Click
Dim sql, oper As String
If flag = 1 Then ' Nuevo
sql = "INSERT INTO Semestre (Semestre,Fecha_Inicio, Fecha_Termino)
VALUES (@Semestre,@Fecha_Inicio, @Fecha_Termino)"
oper = " insertados: "
Else ' Editar
sql = "UPDATE Semestre SET Semestre=@Semestre ,
Fecha_Inicio=@Fecha_Inicio, Fecha_Termino=@Fecha_Termino where
Semestre=@Semestre"
oper = " modificados: "
End If
'Creando comando
Dim objcomando As New SqlCommand(sql, MODCONEXION.Conexion)
Try
objcomando.Parameters.Add(New SqlParameter("@Semestre",
SqlDbType.Char))
objcomando.Parameters("@Semestre").Value = txtSemestre.Text

objcomando.Parameters.Add(New SqlParameter("@Fecha_Inicio",
SqlDbType.DateTime))
objcomando.Parameters("@Fecha_Inicio").Value = txtFechaInicio.Text

objcomando.Parameters.Add(New SqlParameter("@Fecha_Termino",
SqlDbType.DateTime))
objcomando.Parameters("@Fecha_Termino").Value =
txtFechaTermino.Text
MODCONEXION.Conexion.Open()
resultado = objcomando.ExecuteNonQuery
'Ejecuta una instrucción de Transact-SQL en Connection y devuelve
el número de filas afectadas.
Call Actualizar()
'Para actualizar posición
Call NumRegistro()
MessageBox.Show("Registros " & oper & resultado, "", 0,
MessageBoxIcon.Information)
Catch exc As Exception
MessageBox.Show(exc.Message)
End Try
Call HabilitarControles(False)
Call HabilitarBotones(True)
MODCONEXION.Conexion.Close()
End Sub

Private Sub NumRegistro()


Dim num, total As Integer
num = Me.BindingContext(objDataSet, "Semestre").Position + 1
total = Me.objDataSet.Tables("Semestre").Rows.Count
Me.lblRegistro.Text = "Reg: " & Str(num) & " de " & Str(total)
End Sub

Private Sub frmPeriodoAcademico_Closed(ByVal sender As Object, ByVal e As


System.EventArgs) Handles MyBase.Closed
MODCONEXION.FRMAPA = False
End Sub
End Class

Centros de Apoyo
Imports System.Data.SqlClient
Public Class frmActCentro
Inherits System.Windows.Forms.Form
Dim daCentro As SqlDataAdapter
Dim objDataSet As DataSet
Dim flag As Integer
Dim resultado As Integer
Dim strCodigo As String

Const spExploracion = "Centro: Exploración de registros"


Const spNuevo = "Centro: Nuevo Registro"
Const spModificacion = "Centro: Modificación del Registro"
Dim SQLAdapter_Master As SqlDataAdapter
Dim DataSet_Master As DataSet

#Region " Código generado por el Diseñador de Windows Forms "

Public Sub New()


MyBase.New()

'El Diseñador de Windows Forms requiere esta llamada.


InitializeComponent()

'Agregar cualquier inicialización después de la llamada a


InitializeComponent()

End Sub

'Form reemplaza a Dispose para limpiar la lista de componentes.


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Requerido por el Diseñador de Windows Forms


Private components As System.ComponentModel.IContainer

'NOTA: el Diseñador de Windows Forms requiere el siguiente procedimiento


'Puede modificarse utilizando el Diseñador de Windows Forms.
'No lo modifique con el editor de código.
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents txtDescripcion As System.Windows.Forms.TextBox
Friend WithEvents txtCodigo As System.Windows.Forms.TextBox
Friend WithEvents lblRegistro As System.Windows.Forms.Label
Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
Friend WithEvents btnBuscar As System.Windows.Forms.Button
Friend WithEvents btnSalir As System.Windows.Forms.Button
Friend WithEvents btnEliminar As System.Windows.Forms.Button
Friend WithEvents btnCancelar As System.Windows.Forms.Button
Friend WithEvents btnGuardar As System.Windows.Forms.Button
Friend WithEvents btnEditar As System.Windows.Forms.Button
Friend WithEvents btnNuevo As System.Windows.Forms.Button
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents btnUltimo As System.Windows.Forms.Button
Friend WithEvents btnSiguiente As System.Windows.Forms.Button
Friend WithEvents btnAnterior As System.Windows.Forms.Button
Friend WithEvents btnPrimero As System.Windows.Forms.Button
Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(frmActCargo))
Me.Label3 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.txtDescripcion = New System.Windows.Forms.TextBox()
Me.txtCodigo = New System.Windows.Forms.TextBox()
Me.lblRegistro = New System.Windows.Forms.Label()
Me.GroupBox2 = New System.Windows.Forms.GroupBox()
Me.btnBuscar = New System.Windows.Forms.Button()
Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
Me.btnSalir = New System.Windows.Forms.Button()
Me.btnEliminar = New System.Windows.Forms.Button()
Me.btnCancelar = New System.Windows.Forms.Button()
Me.btnGuardar = New System.Windows.Forms.Button()
Me.btnEditar = New System.Windows.Forms.Button()
Me.btnNuevo = New System.Windows.Forms.Button()
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.btnUltimo = New System.Windows.Forms.Button()
Me.btnSiguiente = New System.Windows.Forms.Button()
Me.btnAnterior = New System.Windows.Forms.Button()
Me.btnPrimero = New System.Windows.Forms.Button()
Me.GroupBox2.SuspendLayout()
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'Label3
'
Me.Label3.BackColor = System.Drawing.Color.Transparent
Me.Label3.Font = New System.Drawing.Font("Comic Sans MS", 9.75!,
(System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline),
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label3.ForeColor = System.Drawing.Color.Yellow
Me.Label3.Location = New System.Drawing.Point(8, 128)
Me.Label3.Name = "Label3"
Me.Label3.TabIndex = 53
Me.Label3.Text = "Descripcion:"
'
'Label2
'
Me.Label2.BackColor = System.Drawing.Color.Transparent
Me.Label2.Font = New System.Drawing.Font("Comic Sans MS", 9.75!,
(System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline),
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label2.ForeColor = System.Drawing.Color.Yellow
Me.Label2.Location = New System.Drawing.Point(8, 80)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(136, 23)
Me.Label2.TabIndex = 52
Me.Label2.Text = "Código de Cargo:"
'
'txtDescripcion
'
Me.txtDescripcion.Font = New System.Drawing.Font("Microsoft Sans
Serif", 8.25!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtDescripcion.ForeColor = System.Drawing.SystemColors.HotTrack
Me.txtDescripcion.Location = New System.Drawing.Point(144, 128)
Me.txtDescripcion.Name = "txtDescripcion"
Me.txtDescripcion.Size = New System.Drawing.Size(176, 20)
Me.txtDescripcion.TabIndex = 51
Me.txtDescripcion.Text = ""
'
'txtCodigo
'
Me.txtCodigo.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.txtCodigo.ForeColor = System.Drawing.SystemColors.HotTrack
Me.txtCodigo.Location = New System.Drawing.Point(144, 80)
Me.txtCodigo.Name = "txtCodigo"
Me.txtCodigo.Size = New System.Drawing.Size(152, 20)
Me.txtCodigo.TabIndex = 50
Me.txtCodigo.Text = ""
'
'lblRegistro
'
Me.lblRegistro.Font = New System.Drawing.Font("Times New Roman",
14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.lblRegistro.ForeColor = System.Drawing.Color.Yellow
Me.lblRegistro.Location = New System.Drawing.Point(360, 16)
Me.lblRegistro.Name = "lblRegistro"
Me.lblRegistro.Size = New System.Drawing.Size(192, 24)
Me.lblRegistro.TabIndex = 98
Me.lblRegistro.Text = "Registro:"
'
'GroupBox2
'
Me.GroupBox2.BackColor = System.Drawing.Color.Yellow
Me.GroupBox2.Controls.AddRange(New System.Windows.Forms.Control()
{Me.btnBuscar, Me.btnSalir, Me.btnEliminar, Me.btnCancelar, Me.btnGuardar,
Me.btnEditar, Me.btnNuevo})
Me.GroupBox2.Location = New System.Drawing.Point(24, 176)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(600, 56)
Me.GroupBox2.TabIndex = 96
Me.GroupBox2.TabStop = False
'
'btnBuscar
'
Me.btnBuscar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnBuscar.ForeColor = System.Drawing.Color.Red
Me.btnBuscar.Image = CType(resources.GetObject("btnBuscar.Image"),
System.Drawing.Bitmap)
Me.btnBuscar.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnBuscar.ImageIndex = 7
Me.btnBuscar.ImageList = Me.ImageList1
Me.btnBuscar.Location = New System.Drawing.Point(344, 16)
Me.btnBuscar.Name = "btnBuscar"
Me.btnBuscar.Size = New System.Drawing.Size(80, 24)
Me.btnBuscar.TabIndex = 6
Me.btnBuscar.Text = "&Buscar"
'
'ImageList1
'
Me.ImageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit
Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16)
Me.ImageList1.ImageStream =
CType(resources.GetObject("ImageList1.ImageStream"),
System.Windows.Forms.ImageListStreamer)
Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent
'
'btnSalir
'
Me.btnSalir.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnSalir.ForeColor = System.Drawing.Color.Red
Me.btnSalir.Image = CType(resources.GetObject("btnSalir.Image"),
System.Drawing.Bitmap)
Me.btnSalir.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnSalir.ImageIndex = 6
Me.btnSalir.ImageList = Me.ImageList1
Me.btnSalir.Location = New System.Drawing.Point(504, 16)
Me.btnSalir.Name = "btnSalir"
Me.btnSalir.Size = New System.Drawing.Size(80, 24)
Me.btnSalir.TabIndex = 5
Me.btnSalir.Text = "&Salir"
'
'btnEliminar
'
Me.btnEliminar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnEliminar.ForeColor = System.Drawing.Color.Red
Me.btnEliminar.ImageAlign =
System.Drawing.ContentAlignment.MiddleRight
Me.btnEliminar.ImageList = Me.ImageList1
Me.btnEliminar.Location = New System.Drawing.Point(432, 16)
Me.btnEliminar.Name = "btnEliminar"
Me.btnEliminar.Size = New System.Drawing.Size(64, 24)
Me.btnEliminar.TabIndex = 4
Me.btnEliminar.Text = "&Eliminar"
'
'btnCancelar
'
Me.btnCancelar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnCancelar.ForeColor = System.Drawing.Color.Red
Me.btnCancelar.ImageList = Me.ImageList1
Me.btnCancelar.Location = New System.Drawing.Point(272, 16)
Me.btnCancelar.Name = "btnCancelar"
Me.btnCancelar.Size = New System.Drawing.Size(64, 24)
Me.btnCancelar.TabIndex = 3
Me.btnCancelar.Text = "&Cancelar"
'
'btnGuardar
'
Me.btnGuardar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnGuardar.ForeColor = System.Drawing.Color.Red
Me.btnGuardar.Image = CType(resources.GetObject("btnGuardar.Image"),
System.Drawing.Bitmap)
Me.btnGuardar.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnGuardar.ImageIndex = 10
Me.btnGuardar.ImageList = Me.ImageList1
Me.btnGuardar.Location = New System.Drawing.Point(176, 16)
Me.btnGuardar.Name = "btnGuardar"
Me.btnGuardar.Size = New System.Drawing.Size(88, 24)
Me.btnGuardar.TabIndex = 2
Me.btnGuardar.Text = "&Guardar"
'
'btnEditar
'
Me.btnEditar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnEditar.ForeColor = System.Drawing.Color.Red
Me.btnEditar.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnEditar.ImageList = Me.ImageList1
Me.btnEditar.Location = New System.Drawing.Point(104, 16)
Me.btnEditar.Name = "btnEditar"
Me.btnEditar.Size = New System.Drawing.Size(64, 24)
Me.btnEditar.TabIndex = 1
Me.btnEditar.Text = "&Editar"
'
'btnNuevo
'
Me.btnNuevo.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnNuevo.ForeColor = System.Drawing.Color.Red
Me.btnNuevo.Image = CType(resources.GetObject("btnNuevo.Image"),
System.Drawing.Bitmap)
Me.btnNuevo.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnNuevo.ImageIndex = 14
Me.btnNuevo.ImageList = Me.ImageList1
Me.btnNuevo.Location = New System.Drawing.Point(8, 16)
Me.btnNuevo.Name = "btnNuevo"
Me.btnNuevo.Size = New System.Drawing.Size(80, 24)
Me.btnNuevo.TabIndex = 0
Me.btnNuevo.Text = "&Nuevo"
'
'GroupBox1
'
Me.GroupBox1.BackColor = System.Drawing.Color.Yellow
Me.GroupBox1.Controls.AddRange(New System.Windows.Forms.Control()
{Me.btnUltimo, Me.btnSiguiente, Me.btnAnterior, Me.btnPrimero})
Me.GroupBox1.ForeColor = System.Drawing.SystemColors.ActiveCaption
Me.GroupBox1.Location = New System.Drawing.Point(352, 64)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(240, 88)
Me.GroupBox1.TabIndex = 97
Me.GroupBox1.TabStop = False
'
'btnUltimo
'
Me.btnUltimo.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnUltimo.ForeColor = System.Drawing.Color.Navy
Me.btnUltimo.Location = New System.Drawing.Point(128, 56)
Me.btnUltimo.Name = "btnUltimo"
Me.btnUltimo.Size = New System.Drawing.Size(96, 23)
Me.btnUltimo.TabIndex = 3
Me.btnUltimo.Text = " &Ultimo >>"
'
'btnSiguiente
'
Me.btnSiguiente.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnSiguiente.ForeColor = System.Drawing.Color.Navy
Me.btnSiguiente.Location = New System.Drawing.Point(128, 16)
Me.btnSiguiente.Name = "btnSiguiente"
Me.btnSiguiente.Size = New System.Drawing.Size(96, 24)
Me.btnSiguiente.TabIndex = 2
Me.btnSiguiente.Text = " &Siguiente >>"
'
'btnAnterior
'
Me.btnAnterior.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnAnterior.ForeColor = System.Drawing.Color.Navy
Me.btnAnterior.Location = New System.Drawing.Point(16, 56)
Me.btnAnterior.Name = "btnAnterior"
Me.btnAnterior.Size = New System.Drawing.Size(88, 24)
Me.btnAnterior.TabIndex = 1
Me.btnAnterior.Text = "<< &Anterior"
'
'btnPrimero
'
Me.btnPrimero.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnPrimero.ForeColor = System.Drawing.Color.Navy
Me.btnPrimero.Location = New System.Drawing.Point(16, 16)
Me.btnPrimero.Name = "btnPrimero"
Me.btnPrimero.Size = New System.Drawing.Size(88, 23)
Me.btnPrimero.TabIndex = 0
Me.btnPrimero.Text = "<< &Primero"
'
'frmActCargo
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.Color.Red
Me.ClientSize = New System.Drawing.Size(632, 254)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.GroupBox2,
Me.GroupBox1, Me.Label3, Me.Label2, Me.txtDescripcion, Me.txtCodigo,
Me.lblRegistro})
Me.Name = "frmActCargo"
Me.Text = "Actualizando Cargos"
Me.GroupBox2.ResumeLayout(False)
Me.GroupBox1.ResumeLayout(False)
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub ConfiguraControles(ByVal stStatus As Integer)


txtCentro.Enabled = (stStatus = 1)
txtCiudad.Enabled = (stStatus = 1) Or (stStatus = 2)
btnPrimero.Enabled = (stStatus = 0)
btnAnterior.Enabled = (stStatus = 0)
btnSiguiente.Enabled = (stStatus = 0)
btnUltimo.Enabled = (stStatus = 0)
btnNuevo.Enabled = (stStatus = 0)
btnEditar.Enabled = (stStatus = 0)
btnGuardar.Enabled = (stStatus = 1) Or (stStatus = 2)
btnCancelar.Enabled = (stStatus = 1) Or (stStatus = 2)
btnBuscar.Enabled = (stStatus = 0)
btnEliminar.Enabled = (stStatus = 0)
Select Case stStatus
Case 1 'Agregando nuevo registro
Me.Text = spNuevo
txtCentro.Text = ""
txtCiudad.Text = ""
txtCodigo.Focus()
Case 2 'Modificando registro
Me.Text = spModificacion
txtCiudad.Focus()
Case Else ' Exploracion de datos
Me.Text = spExploracion
End Select
End Sub

Private Sub frmActCentro_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load
MODCONEXION.Conexion.Open()
daCentro = New SqlDataAdapter("SELECT * FROM Centro",
MODCONEXION.Conexion)
objDataSet = New DataSet()
daCentro.Fill(objDataSet, "Centro")
MODCONEXION.Conexion.Close()

Me.txtCentro.DataBindings.Add("Text", objDataSet, "Centro.Cod_Centro")


Me.txtCiudad.DataBindings.Add("Text", objDataSet, "Centro.Ciudad")

Call HabilitarControles(False)
Call HabilitarBotones(True)
Call HabilitarEditar(True)
Call BotonA(True)
Call BotonB(True)
End Sub

Private Sub btnPrimero_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnPrimero.Click
Me.BindingContext(Me.objDataSet, "Centro").Position = 0
Call BotonA(False)
Call BotonB(True)
Call NumRegistro()
End Sub

Private Sub btnSiguiente_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnSiguiente.Click
If Me.BindingContext(objDataSet, "Centro").Position <
(Me.BindingContext(objDataSet, _
"Centro").Count - 1) Then
Me.BindingContext(objDataSet, "Centro").Position = _
(Me.BindingContext(objDataSet, "Centro").Position + 1)
Call BotonA(True)
Else
Call BotonB(False)
End If
Me.NumRegistro()
End Sub
Private Sub btnAnterior_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAnterior.Click
If Me.BindingContext(objDataSet, "Centro").Position > 0 Then
Me.BindingContext(objDataSet, "Centro").Position = _
(Me.BindingContext(objDataSet, "Centro").Position - 1)
Call BotonB(True)
Else
Call BotonA(False)
End If
Me.NumRegistro()
End Sub

Private Sub btnUltimo_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnUltimo.Click
Me.BindingContext(Me.objDataSet, "Centro").Position = _
(Me.objDataSet.Tables("Centro").Rows.Count - 1)
Call BotonB(False)
Call BotonA(True)
Me.NumRegistro()
End Sub

Private Sub btnBuscar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnBuscar.Click
Dim strDato As String
Dim fila As Integer
Dim dv As New DataView()

strDato = InputBox("Ingrese codigo de Centro", "Buscar", "")


strDato = Trim(strDato)
If Len(strDato) < 1 Then Exit Sub
dv.Table = objDataSet.Tables("Cargo")
dv.Sort = "Cod_Centro"
fila = dv.Find(strDato)
If fila = -1 Then
MessageBox.Show("Codigo de Centro no existe", "Cuidado")
Exit Sub
End If
Me.BindingContext(objDataSet, "Centro").Position = fila
Call NumRegistro()
End Sub
Private Sub HabilitarEditar(ByVal est As Boolean)
Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeOf ctrl Is Button Then ctrl.Enabled = est
Next
btnEditar.Enabled = Not est
btnBuscar.Enabled = Not est
btnEliminar.Enabled = Not est
btnNuevo.Enabled = Not est
End Sub
Private Sub btnNuevo_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNuevo.Click
flag = 1

Call HabilitarBotones(False)
Call LimpiarControles()
Call GeneraCodigo()
Call HabilitarEditar(True)
ConfiguraControles(1)

End Sub

Private Sub btnEditar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnEditar.Click
flag = 2

ConfiguraControles(2)

End Sub

Private Sub btnCancelar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnCancelar.Click
MODCONEXION.Conexion.Open()
objDataSet.RejectChanges()
MODCONEXION.Conexion.Close()
btnAnterior.PerformClick()

ConfiguraControles(0)
End Sub

Private Sub btnSalir_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnSalir.Click
MODCONEXION.Conexion.Close()
Me.Close()
End Sub

Private Sub HabilitarControles(ByVal est As Boolean)

Dim ctrl As Control


For Each ctrl In Me.Controls
If TypeOf ctrl Is TextBox Then ctrl.Enabled = est
Next

End Sub

Private Sub HabilitarBotones(ByVal est As Boolean)


Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeOf ctrl Is Button Then ctrl.Enabled = est
Next
btnGuardar.Enabled = Not est
btnCancelar.Enabled = Not est
End Sub

Private Sub LimpiarControles()


Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeOf ctrl Is TextBox Then ctrl.Text = ""
Next
End Sub
Private Sub Actualizar()
objDataSet.Clear()
daCargo.Fill(objDataSet, "Centro")
End Sub

Private Sub GeneraCodigo()


Dim cmd As New SqlCommand("select max(Cod_Centro)from Centro",
MODCONEXION.Conexion)
MODCONEXION.Conexion.Open()
strCodigo = cmd.ExecuteScalar
MODCONEXION.Conexion.Close()
txtCodigo.Text = Format(Val(strCodigo) + 1, "00000")
End Sub

Private Sub BotonB(ByVal VarX As Boolean)


btnSiguiente.Enabled = VarX
btnUltimo.Enabled = VarX
End Sub

Private Sub BotonA(ByVal VarX As Boolean)


btnPrimero.Enabled = VarX
btnAnterior.Enabled = VarX
End Sub

Private Sub btnEliminar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnEliminar.Click
Dim sql3 As String
sql3 = "delete from Centro where Cod_Centro=@Cod_Centro"
Dim objComando As New SqlCommand(sql3, MODCONEXION.Conexion)
Try
objComando.Parameters.Add(New SqlParameter("@Cod_Centro",
SqlDbType.VarChar))
objComando.Parameters("@Cod_Centro").Value = InputBox("Ingrese el
código del Centro a eliminar: ")
MODCONEXION.Conexion.Open()
resultado = objComando.ExecuteNonQuery
Call Actualizar()
btnAnterior.PerformClick() ' Para que muestre el registro anterior
luego de eliminar
MessageBox.Show("Registros Eliminados: " & resultado, "", 0,
MessageBoxIcon.Information)
Catch exc As Exception
MessageBox.Show(exc.Message)
End Try
MODCONEXION.Conexion.Close()
Call HabilitarControles(False)
Call HabilitarBotones(True)
Call BotonA(True)
Call BotonB(True)
End Sub

Private Sub btnGuardar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnGuardar.Click
Dim sql, oper As String
If flag = 1 Then ' Nuevo
sql = "INSERT INTO Centro (Cod_Centro,Descripcion) VALUES
(@Cod_Centro,@Ciudad)"
oper = " insertados: "
Else ' Editar
sql = "UPDATE Cargo SET Cod_Centro=@Cod_Centro , Ciudad=@Ciudad
where Cod_Centro=@Cod_Centro"
oper = " modificados: "
End If
'Creando comando
Dim objcomando As New SqlCommand(sql, MODCONEXION.Conexion)
Try
objcomando.Parameters.Add(New SqlParameter("@Cod_Centro",
SqlDbType.Char))
objcomando.Parameters("@Cod_Centro").Value = txtCodigo.Text

objcomando.Parameters.Add(New SqlParameter("@Ciudad",
SqlDbType.VarChar))
objcomando.Parameters("@Descripcion").Value = txtDescripcion.Text

MODCONEXION.Conexion.Open()
resultado = objcomando.ExecuteNonQuery
'Ejecuta una instrucción de Transact-SQL en Connection y devuelve
el número de filas afectadas.
Call Actualizar()
'Para actualizar posición
Call NumRegistro()
MessageBox.Show("Registros " & oper & resultado, "", 0,
MessageBoxIcon.Information)
Catch exc As Exception
MessageBox.Show(exc.Message)
End Try

MODCONEXION.Conexion.Close()
End Sub

Private Sub NumRegistro()


Dim num, total As Integer
num = Me.BindingContext(objDataSet, "Centro").Position + 1
total = Me.objDataSet.Tables("Centro").Rows.Count
Me.lblRegistro.Text = "Reg: " & Str(num) & " de " & Str(total)
End Sub

Private Sub frmActCargo_Closed(ByVal sender As Object, ByVal e As


System.EventArgs) Handles MyBase.Closed
MODCONEXION.FRMAC = False
End Sub

Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As


System.EventArgs)
End Sub

End Class

REGISTRO DE EXAMENES ATRASADOS


Imports System.Data.SqlClient
Public Class frmActExamen
Inherits System.Windows.Forms.Form
Dim daMatricula As SqlDataAdapter
Dim daCiclo As SqlDataAdapter
Dim daEstudiante As SqlDataAdapter
Dim daSemestre As SqlDataAdapter
Dim objDataSet As DataSet
Dim flag As Integer
Dim resultado As Integer
Dim strCodigo As String

Const spExploracion = "Examen: Exploración de registros"


Const spNuevo = "Examen: Nuevo Registro"
Const spModificacion = "Examen: Modificación del Registro"
Dim SQLAdapter_Master As SqlDataAdapter
Dim DataSet_Master As DataSet

#Region " Código generado por el Diseñador de Windows Forms "

Public Sub New()


MyBase.New()

'El Diseñador de Windows Forms requiere esta llamada.


InitializeComponent()

'Agregar cualquier inicialización después de la llamada a


InitializeComponent()
End Sub

'Form reemplaza a Dispose para limpiar la lista de componentes.


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Requerido por el Diseñador de Windows Forms


Private components As System.ComponentModel.IContainer

'NOTA: el Diseñador de Windows Forms requiere el siguiente procedimiento


'Puede modificarse utilizando el Diseñador de Windows Forms.
'No lo modifique con el editor de código.
Friend WithEvents Label7 As System.Windows.Forms.Label
Friend WithEvents Label6 As System.Windows.Forms.Label
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents txtNumero As System.Windows.Forms.TextBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents cboCiclo As System.Windows.Forms.ComboBox
Friend WithEvents cboPeriodo As System.Windows.Forms.ComboBox
Friend WithEvents cboCodAlumno As System.Windows.Forms.ComboBox
Friend WithEvents cboCodEmpleado As System.Windows.Forms.ComboBox
Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
Friend WithEvents btnBuscar As System.Windows.Forms.Button
Friend WithEvents btnSalir As System.Windows.Forms.Button
Friend WithEvents btnEliminar As System.Windows.Forms.Button
Friend WithEvents btnCancelar As System.Windows.Forms.Button
Friend WithEvents btnGuardar As System.Windows.Forms.Button
Friend WithEvents btnEditar As System.Windows.Forms.Button
Friend WithEvents btnNuevo As System.Windows.Forms.Button
Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
Friend WithEvents lblRegistro As System.Windows.Forms.Label
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents btnUltimo As System.Windows.Forms.Button
Friend WithEvents btnSiguiente As System.Windows.Forms.Button
Friend WithEvents btnAnterior As System.Windows.Forms.Button
Friend WithEvents btnPrimero As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(frmActMatricula))
Me.cboCodAlumno = New System.Windows.Forms.ComboBox()
Me.cboCiclo = New System.Windows.Forms.ComboBox()
Me.cboCodEmpleado = New System.Windows.Forms.ComboBox()
Me.Label7 = New System.Windows.Forms.Label()
Me.Label6 = New System.Windows.Forms.Label()
Me.Label4 = New System.Windows.Forms.Label()
Me.Label1 = New System.Windows.Forms.Label()
Me.txtNumero = New System.Windows.Forms.TextBox()
Me.cboPeriodo = New System.Windows.Forms.ComboBox()
Me.Label2 = New System.Windows.Forms.Label()
Me.GroupBox2 = New System.Windows.Forms.GroupBox()
Me.btnBuscar = New System.Windows.Forms.Button()
Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
Me.btnSalir = New System.Windows.Forms.Button()
Me.btnEliminar = New System.Windows.Forms.Button()
Me.btnCancelar = New System.Windows.Forms.Button()
Me.btnGuardar = New System.Windows.Forms.Button()
Me.btnEditar = New System.Windows.Forms.Button()
Me.btnNuevo = New System.Windows.Forms.Button()
Me.lblRegistro = New System.Windows.Forms.Label()
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.btnUltimo = New System.Windows.Forms.Button()
Me.btnSiguiente = New System.Windows.Forms.Button()
Me.btnAnterior = New System.Windows.Forms.Button()
Me.btnPrimero = New System.Windows.Forms.Button()
Me.GroupBox2.SuspendLayout()
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'cboCodAlumno
'
Me.cboCodAlumno.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.cboCodAlumno.ForeColor = System.Drawing.Color.Navy
Me.cboCodAlumno.Location = New System.Drawing.Point(176, 144)
Me.cboCodAlumno.Name = "cboCodAlumno"
Me.cboCodAlumno.Size = New System.Drawing.Size(160, 21)
Me.cboCodAlumno.TabIndex = 77
'
'cboCiclo
'
Me.cboCiclo.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.cboCiclo.ForeColor = System.Drawing.Color.Navy
Me.cboCiclo.Location = New System.Drawing.Point(176, 104)
Me.cboCiclo.Name = "cboCiclo"
Me.cboCiclo.Size = New System.Drawing.Size(168, 21)
Me.cboCiclo.TabIndex = 76
'
'cboCodEmpleado
'
Me.cboCodEmpleado.Font = New System.Drawing.Font("Microsoft Sans
Serif", 8.25!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.cboCodEmpleado.ForeColor = System.Drawing.Color.Navy
Me.cboCodEmpleado.Location = New System.Drawing.Point(176, 64)
Me.cboCodEmpleado.Name = "cboCodEmpleado"
Me.cboCodEmpleado.Size = New System.Drawing.Size(168, 21)
Me.cboCodEmpleado.TabIndex = 75
'
'Label7
'
Me.Label7.BackColor = System.Drawing.Color.Transparent
Me.Label7.Font = New System.Drawing.Font("Comic Sans MS", 9.75!,
(System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline),
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label7.ForeColor = System.Drawing.Color.Yellow
Me.Label7.Location = New System.Drawing.Point(8, 144)
Me.Label7.Name = "Label7"
Me.Label7.Size = New System.Drawing.Size(136, 23)
Me.Label7.TabIndex = 74
Me.Label7.Text = "Código del Alumno:"
'
'Label6
'
Me.Label6.BackColor = System.Drawing.Color.Transparent
Me.Label6.Font = New System.Drawing.Font("Comic Sans MS", 9.75!,
(System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline),
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label6.ForeColor = System.Drawing.Color.Yellow
Me.Label6.Location = New System.Drawing.Point(8, 104)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(136, 23)
Me.Label6.TabIndex = 73
Me.Label6.Text = "Ciclo:"
'
'Label4
'
Me.Label4.BackColor = System.Drawing.Color.Transparent
Me.Label4.Font = New System.Drawing.Font("Comic Sans MS", 9.75!,
(System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline),
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label4.ForeColor = System.Drawing.Color.Yellow
Me.Label4.Location = New System.Drawing.Point(8, 64)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(152, 23)
Me.Label4.TabIndex = 72
Me.Label4.Text = "Código del Secretaria:"
'
'Label1
'
Me.Label1.BackColor = System.Drawing.Color.Transparent
Me.Label1.Font = New System.Drawing.Font("Comic Sans MS", 9.75!,
(System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline),
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.ForeColor = System.Drawing.Color.Yellow
Me.Label1.Location = New System.Drawing.Point(8, 16)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(152, 23)
Me.Label1.TabIndex = 64
Me.Label1.Text = "Numero de Matrícula:"
'
'txtNumero
'
Me.txtNumero.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.txtNumero.ForeColor = System.Drawing.Color.Navy
Me.txtNumero.Location = New System.Drawing.Point(176, 16)
Me.txtNumero.Name = "txtNumero"
Me.txtNumero.Size = New System.Drawing.Size(128, 20)
Me.txtNumero.TabIndex = 60
Me.txtNumero.Text = ""
'
'cboPeriodo
'
Me.cboPeriodo.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.cboPeriodo.ForeColor = System.Drawing.Color.Navy
Me.cboPeriodo.Location = New System.Drawing.Point(176, 176)
Me.cboPeriodo.Name = "cboPeriodo"
Me.cboPeriodo.Size = New System.Drawing.Size(168, 21)
Me.cboPeriodo.TabIndex = 79
'
'Label2
'
Me.Label2.BackColor = System.Drawing.Color.Transparent
Me.Label2.Font = New System.Drawing.Font("Comic Sans MS", 9.75!,
(System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline),
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label2.ForeColor = System.Drawing.Color.Yellow
Me.Label2.Location = New System.Drawing.Point(8, 176)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(136, 23)
Me.Label2.TabIndex = 78
Me.Label2.Text = "Periodo:"
'
'GroupBox2
'
Me.GroupBox2.BackColor = System.Drawing.Color.Yellow
Me.GroupBox2.Controls.AddRange(New System.Windows.Forms.Control()
{Me.btnBuscar, Me.btnSalir, Me.btnEliminar, Me.btnCancelar, Me.btnGuardar,
Me.btnEditar, Me.btnNuevo})
Me.GroupBox2.Location = New System.Drawing.Point(8, 224)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(616, 56)
Me.GroupBox2.TabIndex = 99
Me.GroupBox2.TabStop = False
'
'btnBuscar
'
Me.btnBuscar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnBuscar.ForeColor = System.Drawing.Color.Red
Me.btnBuscar.Image = CType(resources.GetObject("btnBuscar.Image"),
System.Drawing.Bitmap)
Me.btnBuscar.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnBuscar.ImageIndex = 7
Me.btnBuscar.ImageList = Me.ImageList1
Me.btnBuscar.Location = New System.Drawing.Point(368, 16)
Me.btnBuscar.Name = "btnBuscar"
Me.btnBuscar.Size = New System.Drawing.Size(80, 24)
Me.btnBuscar.TabIndex = 6
Me.btnBuscar.Text = "&Buscar"
'
'ImageList1
'
Me.ImageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit
Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16)
Me.ImageList1.ImageStream =
CType(resources.GetObject("ImageList1.ImageStream"),
System.Windows.Forms.ImageListStreamer)
Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent
'
'btnSalir
'
Me.btnSalir.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnSalir.ForeColor = System.Drawing.Color.Red
Me.btnSalir.Image = CType(resources.GetObject("btnSalir.Image"),
System.Drawing.Bitmap)
Me.btnSalir.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnSalir.ImageIndex = 6
Me.btnSalir.ImageList = Me.ImageList1
Me.btnSalir.Location = New System.Drawing.Point(528, 16)
Me.btnSalir.Name = "btnSalir"
Me.btnSalir.Size = New System.Drawing.Size(80, 24)
Me.btnSalir.TabIndex = 5
Me.btnSalir.Text = "&Salir"
'
'btnEliminar
'
Me.btnEliminar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnEliminar.ForeColor = System.Drawing.Color.Red
Me.btnEliminar.ImageAlign =
System.Drawing.ContentAlignment.MiddleRight
Me.btnEliminar.ImageList = Me.ImageList1
Me.btnEliminar.Location = New System.Drawing.Point(456, 16)
Me.btnEliminar.Name = "btnEliminar"
Me.btnEliminar.Size = New System.Drawing.Size(64, 24)
Me.btnEliminar.TabIndex = 4
Me.btnEliminar.Text = "&Eliminar"
'
'btnCancelar
'
Me.btnCancelar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnCancelar.ForeColor = System.Drawing.Color.Red
Me.btnCancelar.ImageList = Me.ImageList1
Me.btnCancelar.Location = New System.Drawing.Point(296, 16)
Me.btnCancelar.Name = "btnCancelar"
Me.btnCancelar.Size = New System.Drawing.Size(64, 24)
Me.btnCancelar.TabIndex = 3
Me.btnCancelar.Text = "&Cancelar"
'
'btnGuardar
'
Me.btnGuardar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnGuardar.ForeColor = System.Drawing.Color.Red
Me.btnGuardar.Image = CType(resources.GetObject("btnGuardar.Image"),
System.Drawing.Bitmap)
Me.btnGuardar.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnGuardar.ImageIndex = 10
Me.btnGuardar.ImageList = Me.ImageList1
Me.btnGuardar.Location = New System.Drawing.Point(200, 16)
Me.btnGuardar.Name = "btnGuardar"
Me.btnGuardar.Size = New System.Drawing.Size(88, 24)
Me.btnGuardar.TabIndex = 2
Me.btnGuardar.Text = "&Guardar"
'
'btnEditar
'
Me.btnEditar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnEditar.ForeColor = System.Drawing.Color.Red
Me.btnEditar.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnEditar.ImageList = Me.ImageList1
Me.btnEditar.Location = New System.Drawing.Point(120, 16)
Me.btnEditar.Name = "btnEditar"
Me.btnEditar.Size = New System.Drawing.Size(64, 24)
Me.btnEditar.TabIndex = 1
Me.btnEditar.Text = "&Editar"
'
'btnNuevo
'
Me.btnNuevo.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnNuevo.ForeColor = System.Drawing.Color.Red
Me.btnNuevo.Image = CType(resources.GetObject("btnNuevo.Image"),
System.Drawing.Bitmap)
Me.btnNuevo.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnNuevo.ImageIndex = 14
Me.btnNuevo.ImageList = Me.ImageList1
Me.btnNuevo.Location = New System.Drawing.Point(16, 16)
Me.btnNuevo.Name = "btnNuevo"
Me.btnNuevo.Size = New System.Drawing.Size(80, 24)
Me.btnNuevo.TabIndex = 0
Me.btnNuevo.Text = "&Nuevo"
'
'lblRegistro
'
Me.lblRegistro.Font = New System.Drawing.Font("Times New Roman",
14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.lblRegistro.ForeColor = System.Drawing.Color.Yellow
Me.lblRegistro.Location = New System.Drawing.Point(416, 72)
Me.lblRegistro.Name = "lblRegistro"
Me.lblRegistro.Size = New System.Drawing.Size(192, 24)
Me.lblRegistro.TabIndex = 101
Me.lblRegistro.Text = "Registro:"
'
'GroupBox1
'
Me.GroupBox1.BackColor = System.Drawing.Color.Yellow
Me.GroupBox1.Controls.AddRange(New System.Windows.Forms.Control()
{Me.btnUltimo, Me.btnSiguiente, Me.btnAnterior, Me.btnPrimero})
Me.GroupBox1.ForeColor = System.Drawing.SystemColors.ActiveCaption
Me.GroupBox1.Location = New System.Drawing.Point(416, 112)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(212, 88)
Me.GroupBox1.TabIndex = 100
Me.GroupBox1.TabStop = False
'
'btnUltimo
'
Me.btnUltimo.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnUltimo.ForeColor = System.Drawing.Color.Navy
Me.btnUltimo.Location = New System.Drawing.Point(104, 56)
Me.btnUltimo.Name = "btnUltimo"
Me.btnUltimo.Size = New System.Drawing.Size(96, 23)
Me.btnUltimo.TabIndex = 3
Me.btnUltimo.Text = " &Ultimo >>"
'
'btnSiguiente
'
Me.btnSiguiente.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnSiguiente.ForeColor = System.Drawing.Color.Navy
Me.btnSiguiente.Location = New System.Drawing.Point(104, 16)
Me.btnSiguiente.Name = "btnSiguiente"
Me.btnSiguiente.Size = New System.Drawing.Size(96, 24)
Me.btnSiguiente.TabIndex = 2
Me.btnSiguiente.Text = " &Siguiente >>"
'
'btnAnterior
'
Me.btnAnterior.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnAnterior.ForeColor = System.Drawing.Color.Navy
Me.btnAnterior.Location = New System.Drawing.Point(8, 56)
Me.btnAnterior.Name = "btnAnterior"
Me.btnAnterior.Size = New System.Drawing.Size(88, 24)
Me.btnAnterior.TabIndex = 1
Me.btnAnterior.Text = "<< &Anterior"
'
'btnPrimero
'
Me.btnPrimero.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnPrimero.ForeColor = System.Drawing.Color.Navy
Me.btnPrimero.Location = New System.Drawing.Point(8, 16)
Me.btnPrimero.Name = "btnPrimero"
Me.btnPrimero.Size = New System.Drawing.Size(88, 23)
Me.btnPrimero.TabIndex = 0
Me.btnPrimero.Text = "<< &Primero"
'
'frmActMatricula
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.Color.Red
Me.ClientSize = New System.Drawing.Size(640, 302)
Me.Controls.AddRange(New System.Windows.Forms.Control()
{Me.lblRegistro, Me.GroupBox1, Me.cboPeriodo, Me.Label2, Me.cboCodAlumno,
Me.cboCiclo, Me.cboCodEmpleado, Me.Label7, Me.Label6, Me.Label4, Me.Label1,
Me.txtNumero, Me.GroupBox2})
Me.Name = "frmActMatricula"
Me.Text = "frmMatricula"
Me.GroupBox2.ResumeLayout(False)
Me.GroupBox1.ResumeLayout(False)
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub ConfiguraControles(ByVal stStatus As Integer)


txtNumero.Enabled = False '(stStatus = 1)
cboCodEmpleado.Enabled = (stStatus = 1) Or (stStatus = 2)
cboCiclo.Enabled = (stStatus = 1) Or (stStatus = 2)
cboCodEstudiante.Enabled = (stStatus = 1) Or (stStatus = 2)
cboSemestre.Enabled = (stStatus = 1) Or (stStatus = 2)
btnPrimero.Enabled = (stStatus = 0)
btnAnterior.Enabled = (stStatus = 0)
btnSiguiente.Enabled = (stStatus = 0)
btnUltimo.Enabled = (stStatus = 0)
btnNuevo.Enabled = (stStatus = 0)
btnEditar.Enabled = (stStatus = 0)
btnGuardar.Enabled = (stStatus = 1) Or (stStatus = 2)
btnCancelar.Enabled = (stStatus = 1) Or (stStatus = 2)
btnBuscar.Enabled = (stStatus = 0)
btnEliminar.Enabled = (stStatus = 0)

Select Case stStatus


Case 1 'Agregando nuevo registro
Me.Text = spNuevo
txtNumero.Text = ""
cboCiclo.Text = ""
cboCodEstudiante.Text = ""
cboSemestre.Text = ""
txtNumero.Focus()
Case 2 'Modificando registro
Me.Text = spModificacion
txtNumero.Focus()
Case Else ' Exploracion de datos
Me.Text = spExploracion
End Select
End Sub
Private Sub frmActExamen_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
MODCONEXION.Conexion.Open()

daExamen = New SqlDataAdapter("SELECT * FROM Examen",


MODCONEXION.Conexion)
daCiclo = New SqlDataAdapter("select * from Ciclo",
MODCONEXION.Conexion)
daEstudiante = New SqlDataAdapter("select * from Estudiante",
MODCONEXION.Conexion)
daSemestre = New SqlDataAdapter("select * from Semestre",
MODCONEXION.Conexion)

objDataSet = New DataSet()


daMatricula.Fill(objDataSet, "Examen")
daCiclo.Fill(objDataSet, "Ciclo")
daEstudiante.Fill(objDataSet, "Estudiante")
daSemestre.Fill(objDataSet, "Semestre")

MODCONEXION.Conexion.Close()
' Enlazando los controles al campo correspondiente
Me.txtNumero.DataBindings.Add("Text", objDataSet, "Examen.Num_Examen")

Me.cboCiclo.DataBindings.Add(New
System.Windows.Forms.Binding("SelectedValue", Me.objDataSet,
"Examen.Numero_Ciclo"))
Me.cboCiclo.DataSource = Me.objDataSet.Tables("Ciclo")
Me.cboCiclo.DisplayMember = "Numero_Ciclo"
Me.cboCiclo.ValueMember = "Numero_Ciclo"
Me.cboCiclo.DropDownStyle = ComboBoxStyle.DropDownList

Me.cboCodEstudiante.DataBindings.Add(New
System.Windows.Forms.Binding("SelectedValue", Me.objDataSet,
"Examen.Cod_Estudiante"))
Me.cboCodEstudiante.DataSource = Me.objDataSet.Tables("Estudiante")
Me.cboCodEstudiante.DisplayMember = "Cod_Estudiante"
Me.cboCodEstudiante.ValueMember = "Cod_Estudiante"
Me.cboCodEstudiante.DropDownStyle = ComboBoxStyle.DropDownList

Me.cboSemestre.DataBindings.Add(New
System.Windows.Forms.Binding("SelectedValue", Me.objDataSet,
"Examen.Semestre"))
Me.cboSemestre.DataSource = Me.objDataSet.Tables("Semestre")
Me.cboSemestre.DisplayMember = "Semestre"
Me.cboSemestre.ValueMember = "Semestre"
Me.cboSemestre.DropDownStyle = ComboBoxStyle.DropDownList

Call HabilitarControles(True)
Call HabilitarBotones(True)
Call BotonA(True)
Call BotonB(True)
ConfiguraControles(0)
End Sub
Private Sub HabilitarBotones(ByVal est As Boolean)
Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeOf ctrl Is Button Then ctrl.Enabled = est
Next
btnGuardar.Enabled = Not est
btnCancelar.Enabled = Not est
End Sub

Private Sub HabilitarEditar(ByVal est As Boolean)


Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeOf ctrl Is Button Then ctrl.Enabled = est
Next
btnEditar.Enabled = Not est
btnBuscar.Enabled = Not est
btnEliminar.Enabled = Not est
btnNuevo.Enabled = Not est
End Sub

Private Sub LimpiarControles()


Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeOf ctrl Is TextBox Then ctrl.Text = ""
Next
End Sub

Private Sub Actualizar()


objDataSet.Clear()
daExamen.Fill(objDataSet, "Examen")
daCiclo.Fill(objDataSet, "Ciclo")
daAlumno.Fill(objDataSet, "Estudiante")
daPeriodo.Fill(objDataSet, "Semestre")
End Sub

Private Sub GeneraNumero()


Dim cmd As New SqlCommand("select max(Num_Examen)from Examen",
MODCONEXION.Conexion)
MODCONEXION.Conexion.Open()
strCodigo = cmd.ExecuteScalar
MODCONEXION.Conexion.Close()
txtNumero.Text = Format(Val(strCodigo) + 1, "00000")
End Sub

Private Sub BotonB(ByVal VarX As Boolean)


btnSiguiente.Enabled = VarX
btnUltimo.Enabled = VarX
End Sub

Private Sub BotonA(ByVal VarX As Boolean)


btnPrimero.Enabled = VarX
btnAnterior.Enabled = VarX
End Sub

Private Sub NumRegistro()


Dim num, total As Integer
num = Me.BindingContext(objDataSet, "Examen").Position + 1
total = Me.objDataSet.Tables("Examen").Rows.Count
Me.lblRegistro.Text = "Reg: " & Str(num) & " de " & Str(total)
End Sub

Private Sub btnPrimero_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnPrimero.Click
Me.BindingContext(Me.objDataSet, "Examen").Position = 0
Call BotonA(False)
Call BotonB(True)
Call NumRegistro()
End Sub

Private Sub btnSiguiente_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnSiguiente.Click
If Me.BindingContext(objDataSet, "Examen").Position <
(Me.BindingContext(objDataSet, _
"Examen").Count - 1) Then
Me.BindingContext(objDataSet, "Examen").Position = _
(Me.BindingContext(objDataSet, "Examen").Position + 1)
Call BotonA(True)
Else
Call BotonB(False)
End If
Me.NumRegistro()
End Sub

Private Sub btnAnterior_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnAnterior.Click
If Me.BindingContext(objDataSet, "Examen").Position > 0 Then
Me.BindingContext(objDataSet, "Examen").Position = _
(Me.BindingContext(objDataSet, "Examen").Position - 1)
Call BotonB(True)
Else
Call BotonA(False)
End If
Me.NumRegistro()
End Sub

Private Sub btnUltimo_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnUltimo.Click
Me.BindingContext(Me.objDataSet, "Examen").Position = _
(Me.objDataSet.Tables("Examen").Rows.Count - 1)
Call BotonB(False)
Call BotonA(True)
Me.NumRegistro()
End Sub

Private Sub btnBuscar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnBuscar.Click
Dim strDato As String
Dim fila As Integer
Dim dv As New DataView()
strDato = InputBox("Ingrese Numero de Examen", "Buscar", "")
strDato = Trim(strDato)
If Len(strDato) < 1 Then Exit Sub
dv.Table = objDataSet.Tables("Examen")
dv.Sort = "Num_Examen"
fila = dv.Find(strDato)
If fila = -1 Then
MessageBox.Show("Numero de Examen no existe", "Cuidado")
Exit Sub
End If
Me.BindingContext(objDataSet, "Examen").Position = fila
Call NumRegistro()
End Sub

Private Sub btnNuevo_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnNuevo.Click
flag = 1
Call HabilitarBotones(False)
Call LimpiarControles()
Call GeneraNumero()
Call HabilitarEditar(True)
'Call BotonA(False)
'Call BotonB(False)
ConfiguraControles(1)
txtNumero.Focus()
End Sub

Private Sub btnEditar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnEditar.Click
flag = 2
Call HabilitarControles(True)
Call HabilitarBotones(False)

End Sub

Private Sub btnCancelar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnCancelar.Click
MODCONEXION.Conexion.Open()
objDataSet.RejectChanges()
MODCONEXION.Conexion.Close()
btnAnterior.PerformClick()
ConfiguraControles(0)
Call HabilitarControles(False)
Call HabilitarBotones(True)
End Sub

Private Sub btnEliminar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnEliminar.Click
Dim sql3 As String
sql3 = "delete from Examen where Num_Examen=@Num_Examen"
Dim objComando As New SqlCommand(sql3, MODCONEXION.Conexion)
Try
objComando.Parameters.Add(New SqlParameter("@Num_Examen",
SqlDbType.VarChar))
objComando.Parameters("@Num_Examen").Value = InputBox("Ingrese el
numero del Examen a eliminar: ")
MODCONEXION.Conexion.Open()
resultado = objComando.ExecuteNonQuery
Call Actualizar()
btnAnterior.PerformClick() ' Para que muestre el registro anterior
luego de eliminar
MessageBox.Show("Registros Eliminados: " & resultado, "", 0,
MessageBoxIcon.Information)
Catch exc As Exception
MessageBox.Show(exc.Message)
End Try
MODCONEXION.Conexion.Close()
End Sub

Private Sub btnSalir_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnSalir.Click
MODCONEXION.Conexion.Close()
Me.Close()
End Sub

Private Sub btnGuardar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnGuardar.Click
Dim sql, oper As String
If Not Datos_BienEscritos() Then
Exit Sub
End If

If flag = 1 Then ' Nuevo


sql = "INSERT INTO Matricula (Num_Examen, Cod_Semestre,
Cod_Estudiante) VALUES (@Num_Examen, @Cod_Semestre, @Cod_Estudiante)"
oper = " insertados: "
Else ' Editar
sql = "UPDATE Examen SET Num_Examen=@Num_Examen ,
Cod_Semestre=@Cod_Semestre,Cod_Estudiante=@Cod_Estudiante where
Num_Examen=@Num_Examen"
oper = " modificados: "
End If
'Creando comando
Dim objcomando As New SqlCommand(sql, MODCONEXION.Conexion)
Try
objcomando.Parameters.Add(New SqlParameter("@Num_Examen",
SqlDbType.Char))
objcomando.Parameters("@Num_Examen").Value = txtNumero.Text

objcomando.Parameters.Add(New SqlParameter("@Numero_Ciclo",
SqlDbType.Char))
objcomando.Parameters("@Numero_Ciclo").Value =
cboCiclo.SelectedValue

objcomando.Parameters.Add(New SqlParameter("@Cod_Estudiante",
SqlDbType.Char))
objcomando.Parameters("@Cod_Estudiante").Value =
cboCodEstudiante.SelectedValue

objcomando.Parameters.Add(New SqlParameter("@Semestre",
SqlDbType.Char))
objcomando.Parameters("@Semestre").Value =
cboPeriodo.SelectedValue
MODCONEXION.Conexion.Open()
resultado = objcomando.ExecuteNonQuery
'Ejecuta una instrucción de Transact-SQL en Connection y devuelve
el número de filas afectadas.
Call Actualizar()
'Para actualizar posición
Call NumRegistro()
MessageBox.Show("Registros " & oper & resultado, "", 0,
MessageBoxIcon.Information)
ConfiguraControles(0)
Catch exc As Exception
MessageBox.Show(exc.Message)
End Try
Call HabilitarControles(False)
Call HabilitarBotones(True)
MODCONEXION.Conexion.Close()
End Sub

Private Function CountRegistros(ByVal FieldCount As String, ByVal SQL As


String) As Integer
Dim oCNN As System.Data.SqlClient.SqlConnection
Dim oCMD As System.Data.SqlClient.SqlCommand
Dim oDRD As System.Data.SqlClient.SqlDataReader
Dim i As Integer
i = 0
oCNN = MODCONEXION.Conexion
oCMD = NewComando(oCNN, SQL, CommandType.Text)
Try
oCNN.Open()
oDRD = oCMD.ExecuteReader
If Not (oDRD.Read) Then
i = 0
Else
i = oDRD.Item(FieldCount)
End If
Catch xErr As Exception
MsgBox(xErr.Message)
Finally
oCNN.Close()
oCMD = Nothing
oDRD = Nothing
End Try
Return i
End Function

Private Function Datos_BienEscritos() As Boolean


Dim s As String
txtNumero.Text = Trim(txtNumero.Text)
'cboCiclo.Text = Trim(cboCiclo.Text)
'cboCodAlumno.Text = Trim(cboCodEstudiante.Text)
'cboSemestre.Text = Trim(cboSemestre.Text)
If (Len(txtNumero.Text) < 1) And (spModificacion = Me.Text) Then
MessageBox.Show("Escriba los nombres.Actualización cancelada",
"Faltan datos", 0, MessageBoxIcon.Information)
Return False
End If
If (Len(cboCodEmpleado.Text) < 1) Then
MessageBox.Show("Escriba los nombres.Actualización cancelada",
"Faltan datos", 0, MessageBoxIcon.Information)
cboCodEmpleado.Focus()
Return False
End If

If (Len(cboCiclo.Text) < 1) Then


MessageBox.Show("Escriba los Apellidos.Actualización cancelada",
"Faltan datos", 0, MessageBoxIcon.Information)
cboCiclo.Focus()
Return False
End If

If (Len(cboCodEstudiante.Text) < 1) Then


MessageBox.Show("Escriba los Apellidos.Actualización cancelada",
"Faltan datos", 0, MessageBoxIcon.Information)
cboCodAlumno.Focus()
Return False
End If

If (Len(cboSemestre.Text) < 1) Then


MessageBox.Show("Escriba los Apellidos.Actualización cancelada",
"Faltan datos", 0, MessageBoxIcon.Information)
cboSemestre.Focus()
Return False
End If

s = "SELECT total=Count(Num_Examen) FROM Examen WHERE


(Cod_Estudiante='" & cboCodEstudiante.SelectedValue & "')"
If Me.Text = spModificacion Then
s = s & " AND NOT (Num_Examen='" & txtNumero.Text & "')"
End If
If (CountRegistros("total", s) > 0) Then
MessageBox.Show("Ese nombre ya existe en la BD.Actualización
cancelada", "Faltan datos", 0, MessageBoxIcon.Information)
txtNumero.Focus()
Return False
End If
If Me.Text = spNuevo Then
s = "SELECT total=Count(Num_Matricula) FROM matricula WHERE
(Num_Examen='" & txtNumero.Text & "')"
If (CountRegistros("total", s) > 0) Then GeneraNumero()
End If
Return True
End Function

Private Function ActualizarBaseDeDatos(ByVal IsInsercion As Boolean) As


Boolean
Dim oCNN As System.Data.SqlClient.SqlConnection
Dim oCMD As System.Data.SqlClient.SqlCommand
Dim oPRM As System.Data.SqlClient.SqlParameter
Dim Codigo As Integer
Dim r As Boolean
Codigo = 0
r = True
' oCNN = Conector.NewConexion()
' oCNN.Open()
oCNN = MODCONEXION.Conexion
If IsInsercion Then
GeneraNumero()
oCMD = NewComando(oCNN, "dbo.InsertExamen",
CommandType.StoredProcedure)
Else
oCMD = NewComando(oCNN, "dbo.ActualizarExamen",
CommandType.StoredProcedure)
End If
oPRM = NewParameter("Nom_Estudiante", True, SqlDbType.VarChar, 20,
cboCodEmpleado.Text)
oCMD.Parameters.Add(oPRM)
oPRM = NewParameter("Ape_Estudiante", True, SqlDbType.VarChar, 20,
cboCiclo.Text)
oCMD.Parameters.Add(oPRM)
oPRM = NewParameter("Fecha_Ingreso", True, SqlDbType.DateTime, 8,
cboCodAlumno.Text)
oCMD.Parameters.Add(oPRM)
oPRM = NewParameter("Tipo_Estudiante", True, SqlDbType.Char, 18,
cboPeriodo.Text)
oCMD.Parameters.Add(oPRM)
oPRM = NewParameter("Cod_Estudiante", True, SqlDbType.Char, 18,
txtNumero.Text)
oCMD.Parameters.Add(oPRM)

Try
oCNN.Open()
oCMD.ExecuteNonQuery()
Catch xErr As Exception
MsgBox(xErr.Message)
r = False
Finally
oCNN.Close()
oCMD = Nothing
oPRM = Nothing
oCNN = Nothing
End Try
Return r
End Function

Protected Overrides Sub Finalize()


MyBase.Finalize()
End Sub

Private Sub frmActExamen_Closed(ByVal sender As Object, ByVal e As


System.EventArgs) Handles MyBase.Closed
MODCONEXION.FRMAM = False
End Sub

End Class
PAGO VALOR PARA TOMA EXAMEN ATRASADO

Imports System.Data.SqlClient
Public Class frmActFichaPagos
Inherits System.Windows.Forms.Form
Dim daFicha_Pagos As SqlDataAdapter
Dim daAlumno As SqlDataAdapter
Dim objDataSet As DataSet
Dim flag As Integer
Dim resultado As Integer
Dim strCodigo As String
Const spExploracion = "FichaPago: Exploración de registros"
Const spNuevo = "FichaPago: Nuevo Registro"
Const spModificacion = "FichaPago: Modificación del Registro"
Dim SQLAdapter_Master As SqlDataAdapter
Dim DataSet_Master As DataSet

#Region " Código generado por el Diseñador de Windows Forms "

Public Sub New()


MyBase.New()

'El Diseñador de Windows Forms requiere esta llamada.


InitializeComponent()

'Agregar cualquier inicialización después de la llamada a


InitializeComponent()

End Sub
'Form reemplaza a Dispose para limpiar la lista de componentes.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Requerido por el Diseñador de Windows Forms


Private components As System.ComponentModel.IContainer

'NOTA: el Diseñador de Windows Forms requiere el siguiente procedimiento


'Puede modificarse utilizando el Diseñador de Windows Forms.
'No lo modifique con el editor de código.
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label7 As System.Windows.Forms.Label
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents txtNumero As System.Windows.Forms.TextBox
Friend WithEvents txtMonto As System.Windows.Forms.TextBox
Friend WithEvents cboAlumno As System.Windows.Forms.ComboBox
Friend WithEvents cboEmpleado As System.Windows.Forms.ComboBox
Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
Friend WithEvents btnBuscar As System.Windows.Forms.Button
Friend WithEvents btnSalir As System.Windows.Forms.Button
Friend WithEvents btnEliminar As System.Windows.Forms.Button
Friend WithEvents btnCancelar As System.Windows.Forms.Button
Friend WithEvents btnGuardar As System.Windows.Forms.Button
Friend WithEvents btnEditar As System.Windows.Forms.Button
Friend WithEvents btnNuevo As System.Windows.Forms.Button
Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
Friend WithEvents lblRegistro As System.Windows.Forms.Label
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents btnUltimo As System.Windows.Forms.Button
Friend WithEvents btnSiguiente As System.Windows.Forms.Button
Friend WithEvents btnAnterior As System.Windows.Forms.Button
Friend WithEvents btnPrimero As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(frmActFichaPagos))
Me.Label3 = New System.Windows.Forms.Label()
Me.txtMonto = New System.Windows.Forms.TextBox()
Me.cboAlumno = New System.Windows.Forms.ComboBox()
Me.Label2 = New System.Windows.Forms.Label()
Me.cboEmpleado = New System.Windows.Forms.ComboBox()
Me.Label7 = New System.Windows.Forms.Label()
Me.Label1 = New System.Windows.Forms.Label()
Me.txtNumero = New System.Windows.Forms.TextBox()
Me.GroupBox2 = New System.Windows.Forms.GroupBox()
Me.btnBuscar = New System.Windows.Forms.Button()
Me.btnSalir = New System.Windows.Forms.Button()
Me.btnEliminar = New System.Windows.Forms.Button()
Me.btnCancelar = New System.Windows.Forms.Button()
Me.btnGuardar = New System.Windows.Forms.Button()
Me.btnEditar = New System.Windows.Forms.Button()
Me.btnNuevo = New System.Windows.Forms.Button()
Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
Me.lblRegistro = New System.Windows.Forms.Label()
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.btnUltimo = New System.Windows.Forms.Button()
Me.btnSiguiente = New System.Windows.Forms.Button()
Me.btnAnterior = New System.Windows.Forms.Button()
Me.btnPrimero = New System.Windows.Forms.Button()
Me.GroupBox2.SuspendLayout()
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'Label3
'
Me.Label3.BackColor = System.Drawing.Color.Transparent
Me.Label3.Font = New System.Drawing.Font("Comic Sans MS", 9.75!,
(System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline),
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label3.ForeColor = System.Drawing.Color.Yellow
Me.Label3.Location = New System.Drawing.Point(8, 72)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(152, 23)
Me.Label3.TabIndex = 101
Me.Label3.Text = "Monto:"
'
'txtMonto
'
Me.txtMonto.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.txtMonto.ForeColor = System.Drawing.Color.Navy
Me.txtMonto.Location = New System.Drawing.Point(176, 72)
Me.txtMonto.Name = "txtMonto"
Me.txtMonto.Size = New System.Drawing.Size(96, 20)
Me.txtMonto.TabIndex = 100
Me.txtMonto.Text = ""
'
'cboAlumno
'
Me.cboAlumno.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.cboAlumno.ForeColor = System.Drawing.Color.Navy
Me.cboAlumno.Location = New System.Drawing.Point(176, 104)
Me.cboAlumno.Name = "cboAlumno"
Me.cboAlumno.Size = New System.Drawing.Size(121, 21)
Me.cboAlumno.TabIndex = 99
'
'Label2
'
Me.Label2.BackColor = System.Drawing.Color.Transparent
Me.Label2.Font = New System.Drawing.Font("Comic Sans MS", 9.75!,
(System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline),
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label2.ForeColor = System.Drawing.Color.Yellow
Me.Label2.Location = New System.Drawing.Point(8, 104)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(136, 23)
Me.Label2.TabIndex = 98
Me.Label2.Text = "Cod_Alumno:"
'
'cboEmpleado
'
Me.cboEmpleado.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.cboEmpleado.ForeColor = System.Drawing.Color.Navy
Me.cboEmpleado.Location = New System.Drawing.Point(176, 136)
Me.cboEmpleado.Name = "cboEmpleado"
Me.cboEmpleado.Size = New System.Drawing.Size(121, 21)
Me.cboEmpleado.TabIndex = 97
'
'Label7
'
Me.Label7.BackColor = System.Drawing.Color.Transparent
Me.Label7.Font = New System.Drawing.Font("Comic Sans MS", 9.75!,
(System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline),
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label7.ForeColor = System.Drawing.Color.Yellow
Me.Label7.Location = New System.Drawing.Point(8, 136)
Me.Label7.Name = "Label7"
Me.Label7.Size = New System.Drawing.Size(136, 23)
Me.Label7.TabIndex = 96
Me.Label7.Text = "Cod_Empleado:"
'
'Label1
'
Me.Label1.BackColor = System.Drawing.Color.Transparent
Me.Label1.Font = New System.Drawing.Font("Comic Sans MS", 9.75!,
(System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline),
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.ForeColor = System.Drawing.Color.Yellow
Me.Label1.Location = New System.Drawing.Point(8, 16)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(152, 23)
Me.Label1.TabIndex = 95
Me.Label1.Text = "Numero de Ficha:"
'
'txtNumero
'
Me.txtNumero.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.txtNumero.ForeColor = System.Drawing.Color.Navy
Me.txtNumero.Location = New System.Drawing.Point(176, 16)
Me.txtNumero.Name = "txtNumero"
Me.txtNumero.Size = New System.Drawing.Size(80, 20)
Me.txtNumero.TabIndex = 94
Me.txtNumero.Text = ""
'
'GroupBox2
'
Me.GroupBox2.BackColor = System.Drawing.Color.Yellow
Me.GroupBox2.Controls.AddRange(New System.Windows.Forms.Control()
{Me.btnBuscar, Me.btnSalir, Me.btnEliminar, Me.btnCancelar, Me.btnGuardar,
Me.btnEditar, Me.btnNuevo})
Me.GroupBox2.Location = New System.Drawing.Point(8, 176)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(608, 56)
Me.GroupBox2.TabIndex = 102
Me.GroupBox2.TabStop = False
'
'btnBuscar
'
Me.btnBuscar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnBuscar.ForeColor = System.Drawing.Color.Red
Me.btnBuscar.Image = CType(resources.GetObject("btnBuscar.Image"),
System.Drawing.Bitmap)
Me.btnBuscar.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnBuscar.ImageIndex = 7
Me.btnBuscar.ImageList = Me.ImageList1
Me.btnBuscar.Location = New System.Drawing.Point(360, 16)
Me.btnBuscar.Name = "btnBuscar"
Me.btnBuscar.Size = New System.Drawing.Size(80, 24)
Me.btnBuscar.TabIndex = 6
Me.btnBuscar.Text = "&Buscar"
'
'btnSalir
'
Me.btnSalir.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnSalir.ForeColor = System.Drawing.Color.Red
Me.btnSalir.Image = CType(resources.GetObject("btnSalir.Image"),
System.Drawing.Bitmap)
Me.btnSalir.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnSalir.ImageIndex = 6
Me.btnSalir.ImageList = Me.ImageList1
Me.btnSalir.Location = New System.Drawing.Point(520, 16)
Me.btnSalir.Name = "btnSalir"
Me.btnSalir.Size = New System.Drawing.Size(80, 24)
Me.btnSalir.TabIndex = 5
Me.btnSalir.Text = "&Salir"
'
'btnEliminar
'
Me.btnEliminar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnEliminar.ForeColor = System.Drawing.Color.Red
Me.btnEliminar.ImageAlign =
System.Drawing.ContentAlignment.MiddleRight
Me.btnEliminar.ImageList = Me.ImageList1
Me.btnEliminar.Location = New System.Drawing.Point(448, 16)
Me.btnEliminar.Name = "btnEliminar"
Me.btnEliminar.Size = New System.Drawing.Size(64, 24)
Me.btnEliminar.TabIndex = 4
Me.btnEliminar.Text = "&Eliminar"
'
'btnCancelar
'
Me.btnCancelar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnCancelar.ForeColor = System.Drawing.Color.Red
Me.btnCancelar.ImageList = Me.ImageList1
Me.btnCancelar.Location = New System.Drawing.Point(288, 16)
Me.btnCancelar.Name = "btnCancelar"
Me.btnCancelar.Size = New System.Drawing.Size(64, 24)
Me.btnCancelar.TabIndex = 3
Me.btnCancelar.Text = "&Cancelar"
'
'btnGuardar
'
Me.btnGuardar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnGuardar.ForeColor = System.Drawing.Color.Red
Me.btnGuardar.Image = CType(resources.GetObject("btnGuardar.Image"),
System.Drawing.Bitmap)
Me.btnGuardar.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnGuardar.ImageIndex = 10
Me.btnGuardar.ImageList = Me.ImageList1
Me.btnGuardar.Location = New System.Drawing.Point(192, 16)
Me.btnGuardar.Name = "btnGuardar"
Me.btnGuardar.Size = New System.Drawing.Size(88, 24)
Me.btnGuardar.TabIndex = 2
Me.btnGuardar.Text = "&Guardar"
'
'btnEditar
'
Me.btnEditar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnEditar.ForeColor = System.Drawing.Color.Red
Me.btnEditar.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnEditar.ImageList = Me.ImageList1
Me.btnEditar.Location = New System.Drawing.Point(112, 16)
Me.btnEditar.Name = "btnEditar"
Me.btnEditar.Size = New System.Drawing.Size(64, 24)
Me.btnEditar.TabIndex = 1
Me.btnEditar.Text = "&Editar"
'
'btnNuevo
'
Me.btnNuevo.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnNuevo.ForeColor = System.Drawing.Color.Red
Me.btnNuevo.Image = CType(resources.GetObject("btnNuevo.Image"),
System.Drawing.Bitmap)
Me.btnNuevo.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnNuevo.ImageIndex = 14
Me.btnNuevo.ImageList = Me.ImageList1
Me.btnNuevo.Location = New System.Drawing.Point(8, 16)
Me.btnNuevo.Name = "btnNuevo"
Me.btnNuevo.Size = New System.Drawing.Size(80, 24)
Me.btnNuevo.TabIndex = 0
Me.btnNuevo.Text = "&Nuevo"
'
'ImageList1
'
Me.ImageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit
Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16)
Me.ImageList1.ImageStream =
CType(resources.GetObject("ImageList1.ImageStream"),
System.Windows.Forms.ImageListStreamer)
Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent
'
'lblRegistro
'
Me.lblRegistro.Font = New System.Drawing.Font("Times New Roman",
14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.lblRegistro.ForeColor = System.Drawing.Color.Yellow
Me.lblRegistro.Location = New System.Drawing.Point(352, 32)
Me.lblRegistro.Name = "lblRegistro"
Me.lblRegistro.Size = New System.Drawing.Size(192, 24)
Me.lblRegistro.TabIndex = 104
Me.lblRegistro.Text = "Registro:"
'
'GroupBox1
'
Me.GroupBox1.BackColor = System.Drawing.Color.Yellow
Me.GroupBox1.Controls.AddRange(New System.Windows.Forms.Control()
{Me.btnUltimo, Me.btnSiguiente, Me.btnAnterior, Me.btnPrimero})
Me.GroupBox1.ForeColor = System.Drawing.SystemColors.ActiveCaption
Me.GroupBox1.Location = New System.Drawing.Point(352, 72)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(208, 88)
Me.GroupBox1.TabIndex = 103
Me.GroupBox1.TabStop = False
'
'btnUltimo
'
Me.btnUltimo.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnUltimo.ForeColor = System.Drawing.Color.Navy
Me.btnUltimo.Location = New System.Drawing.Point(104, 56)
Me.btnUltimo.Name = "btnUltimo"
Me.btnUltimo.Size = New System.Drawing.Size(96, 23)
Me.btnUltimo.TabIndex = 3
Me.btnUltimo.Text = " &Ultimo >>"
'
'btnSiguiente
'
Me.btnSiguiente.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnSiguiente.ForeColor = System.Drawing.Color.Navy
Me.btnSiguiente.Location = New System.Drawing.Point(104, 16)
Me.btnSiguiente.Name = "btnSiguiente"
Me.btnSiguiente.Size = New System.Drawing.Size(96, 24)
Me.btnSiguiente.TabIndex = 2
Me.btnSiguiente.Text = " &Siguiente >>"
'
'btnAnterior
'
Me.btnAnterior.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnAnterior.ForeColor = System.Drawing.Color.Navy
Me.btnAnterior.Location = New System.Drawing.Point(8, 56)
Me.btnAnterior.Name = "btnAnterior"
Me.btnAnterior.Size = New System.Drawing.Size(88, 24)
Me.btnAnterior.TabIndex = 1
Me.btnAnterior.Text = "<< &Anterior"
'
'btnPrimero
'
Me.btnPrimero.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnPrimero.ForeColor = System.Drawing.Color.Navy
Me.btnPrimero.Location = New System.Drawing.Point(8, 16)
Me.btnPrimero.Name = "btnPrimero"
Me.btnPrimero.Size = New System.Drawing.Size(88, 23)
Me.btnPrimero.TabIndex = 0
Me.btnPrimero.Text = "<< &Primero"
'
'frmActFichaPagos
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.Color.Red
Me.ClientSize = New System.Drawing.Size(640, 254)
Me.Controls.AddRange(New System.Windows.Forms.Control()
{Me.lblRegistro, Me.GroupBox1, Me.Label3, Me.txtMonto, Me.cboAlumno,
Me.Label2, Me.cboEmpleado, Me.Label7, Me.Label1, Me.txtNumero, Me.GroupBox2})
Me.Name = "frmActFichaPagos"
Me.Text = "frmActFichaPagos"
Me.GroupBox2.ResumeLayout(False)
Me.GroupBox1.ResumeLayout(False)
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub ConfiguraControles(ByVal stStatus As Integer)


txtNumero.Enabled = (stStatus = 1)
txtMonto.Enabled = (stStatus = 1) Or (stStatus = 2)
cboAlumno.Enabled = (stStatus = 1) Or (stStatus = 2)

Select Case stStatus


Case 1 'Agregando nuevo registro
Me.Text = spNuevo
txtNumero.Text = ""
txtMonto.Text = ""
cboAlumno.Text = ""
txtMonto.Focus()
Case 2 'Modificando registro
Me.Text = spModificacion
txtMonto.Focus()
Case Else ' Exploracion de datos
Me.Text = spExploracion
End Select
End Sub
Private Sub frmActFichaPagos_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load
MODCONEXION.Conexion.Open()
daFicha_Pagos = New SqlDataAdapter("Select * From Ficha_Pagos",
MODCONEXION.Conexion)
daAlumno = New SqlDataAdapter("Select * From Alumno",
MODCONEXION.Conexion)
objDataSet = New DataSet()
daFicha_Pagos.Fill(objDataSet, "Ficha_Pagos")
daAlumno.Fill(objDataSet, "Alumno")
MODCONEXION.Conexion.Close()

Me.txtNumero.DataBindings.Add("Text", objDataSet,
"Ficha_Pagos.Num_Ficha")
Me.txtMonto.DataBindings.Add("Text", objDataSet, "Ficha_Pagos.Monto")

Me.cboAlumno.DataBindings.Add(New
System.Windows.Forms.Binding("SelectedValue", Me.objDataSet,
"Ficha_Pagos.Cod_Alumno"))
Me.cboAlumno.DataSource = Me.objDataSet.Tables("Alumno")
Me.cboAlumno.DisplayMember = "Nom_Alumno"
Me.cboAlumno.ValueMember = "Cod_Alumno"
Me.cboAlumno.DropDownStyle = ComboBoxStyle.DropDownList

Call HabilitarControles(True)
Call HabilitarBotones(True)
Call BotonA(True)
Call BotonB(True)

ConfiguraControles(0)

End Sub

Private Sub btnPrimero_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnPrimero.Click
Me.BindingContext(Me.objDataSet, "Ficha_Pagos").Position = 0
Call BotonA(False)
Call BotonB(True)
Call NumRegistro()
End Sub

Private Sub btnSiguiente_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnSiguiente.Click
If Me.BindingContext(objDataSet, "Ficha_Pagos").Position <
(Me.BindingContext(objDataSet, _
"Ficha_Pagos").Count - 1) Then
Me.BindingContext(objDataSet, "Ficha_Pagos").Position = _
(Me.BindingContext(objDataSet, "Ficha_Pagos").Position + 1)
Call BotonA(True)
Else
Call BotonB(False)
End If
Me.NumRegistro()
End Sub

Private Sub btnAnterior_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnAnterior.Click
If Me.BindingContext(objDataSet, "Ficha_Pagos").Position > 0 Then
Me.BindingContext(objDataSet, "Ficha_Pagos").Position = _
(Me.BindingContext(objDataSet, "Ficha_Pagos").Position - 1)
Call BotonB(True)
Else
Call BotonA(False)
End If
Me.NumRegistro()
End Sub

Private Sub btnUltimo_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnUltimo.Click
Me.BindingContext(Me.objDataSet, "Ficha_Pagos").Position = _
(Me.objDataSet.Tables("Ficha_Pagos").Rows.Count - 1)
Call BotonB(False)
Call BotonA(True)
Me.NumRegistro()
End Sub

Private Sub btnBuscar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnBuscar.Click
Dim strDato As String
Dim fila As Integer
Dim dv As New DataView()
strDato = InputBox("Ingrese codigo de Ficha_Pagos", "Buscar")
dv.Table = objDataSet.Tables("Ficha_Pagos")
dv.Sort = "Num_Ficha"
fila = dv.Find(strDato)
If fila = -1 Then
MessageBox.Show("Codigo de Cod_Alumno no existe", "Cuidado")
Exit Sub
End If
Me.BindingContext(objDataSet, "Ficha_Pagos").Position = fila
Call NumRegistro()
End Sub

Private Sub btnNuevo_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnNuevo.Click
flag = 1
Call HabilitarControles(True)
Call HabilitarBotones(False)
Call LimpiarControles()
ConfiguraControles(1)

txtNumero.Focus()
End Sub

Private Sub btnEditar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnEditar.Click
flag = 2
Call HabilitarControles(True)
Call HabilitarBotones(False)
ConfiguraControles(2)
End Sub

Private Sub btnGuardar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnGuardar.Click
Dim sql, oper As String
If flag = 1 Then ' Nuevo
sql = "INSERT INTO Entrada (Num_Ficha, Monto, Cod_Alumno, ) VALUES
(@Num_Ficha, @Monto, @Cod_Alumno)"
oper = " insertados: "
Else ' Editar
sql = "UPDATE Entrada SET Num_Ficha=@Num_Ficha, Monto=@Monto,
Cod_Alumno=@Cod_Alumno, where Num_Ficha=@Num_Ficha"
oper = " modificados: "
End If
'Creando comando
Dim objcomando As New SqlCommand(sql, MODCONEXION.Conexion)
Try
objcomando.Parameters.Add(New SqlParameter("@Num_Ficha",
SqlDbType.Char))
objcomando.Parameters("@Num_Ficha").Value = txtNumero.Text

objcomando.Parameters.Add(New SqlParameter("@Monto",
SqlDbType.Decimal))
objcomando.Parameters("@Monto").Value = txtMonto.Text

objcomando.Parameters.Add(New SqlParameter("@Cod_Alumno",
SqlDbType.Char))
objcomando.Parameters("@Cod_Alumno").Value =
cboAlumno.SelectedValue

MODCONEXION.Conexion.Open()
resultado = objcomando.ExecuteNonQuery
'Ejecuta una instrucción de Transact-SQL en Connection y devuelve
el número de filas afectadas.
Call Actualizar()
'Para actualizar posición
Call NumRegistro()
MessageBox.Show("Registros " & oper & resultado, "", 0,
MessageBoxIcon.Information)
Catch exc As Exception
MessageBox.Show(exc.Message)
End Try
Call HabilitarControles(False)
Call HabilitarBotones(True)
MODCONEXION.Conexion.Close()
End Sub
Private Sub btnCancelar_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCancelar.Click
MODCONEXION.Conexion.Open()
objDataSet.RejectChanges()
MODCONEXION.Conexion.Close()
btnAnterior.PerformClick()
Call HabilitarControles(False)
Call HabilitarBotones(True)
End Sub

Private Sub btnSalir_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnSalir.Click
MODCONEXION.Conexion.Close()
Me.Close()
End Sub

Private Sub HabilitarControles(ByVal est As Boolean)

Dim ctrl As Control


For Each ctrl In Me.Controls
If TypeOf ctrl Is TextBox Then ctrl.Enabled = est
Next
cboAlumno.Enabled = est
cboEmpleado.Enabled = est
End Sub

Private Sub HabilitarBotones(ByVal est As Boolean)


Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeOf ctrl Is Button Then ctrl.Enabled = est
Next
btnGuardar.Enabled = Not est
btnCancelar.Enabled = Not est
End Sub

Private Sub LimpiarControles()


Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeOf ctrl Is TextBox Then ctrl.Text = ""
Next
End Sub

Private Sub NumRegistro()


Dim num, total As Integer
num = Me.BindingContext(objDataSet, "Ficha_Pagos").Position + 1
total = Me.objDataSet.Tables("Ficha_Pagos").Rows.Count
Me.lblRegistro.Text = "Reg: " & Str(num) & " de " & Str(total)
End Sub

Private Sub Actualizar()


objDataSet.Clear()
daFicha_Pagos.Fill(objDataSet, "Ficha_Pagos")
daAlumno.Fill(objDataSet, "Alumno")
End Sub

Private Sub BotonB(ByVal VarX As Boolean)


btnSiguiente.Enabled = VarX
btnUltimo.Enabled = VarX
End Sub

Private Sub BotonA(ByVal VarX As Boolean)


btnPrimero.Enabled = VarX
btnAnterior.Enabled = VarX
End Sub

Private Sub btnEliminar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnEliminar.Click
Dim sql3 As String
sql3 = "delete from Ficha_Pagos where Num_Ficha=@Num_Ficha"
Dim objComando As New SqlCommand(sql3, MODCONEXION.Conexion)
Try
objComando.Parameters.Add(New SqlParameter("@Num_Ficha",
SqlDbType.VarChar))
objComando.Parameters("@Num_Ficha").Value = InputBox("Ingrese el
código del Ficha_Pagos a eliminar: ")
MODCONEXION.Conexion.Open()
resultado = objComando.ExecuteNonQuery
Call Actualizar()
btnAnterior.PerformClick() ' Para que muestre el registro anterior
luego de eliminar
MessageBox.Show("Registros Eliminados: " & resultado, "", 0,
MessageBoxIcon.Information)
Catch exc As Exception
MessageBox.Show(exc.Message)
End Try
MODCONEXION.Conexion.Close()
Call HabilitarControles(False)
Call HabilitarBotones(True)
Call BotonA(True)
Call BotonB(True)
End Sub

Private Sub frmActFichaPagos_Closed(ByVal sender As Object, ByVal e As


System.EventArgs) Handles MyBase.Closed
MODCONEXION.FRMAFP = False
End Sub
End Class

FORMULARIO PARA BUSQUEDA DE ESTUDIANTES POR NOMBRE, APELLIDO O


CODIGO
Imports System.Data.SqlClient
Public Class frmConAlumnos
Inherits System.Windows.Forms.Form
Dim strcampo As String
Dim objConnection As New SqlConnection() ' creando objeto Connection
Dim objCommand As SqlCommand ' objeto Comando
Dim objDataAdapter As SqlDataAdapter ' objeto Adaptador de datos
Dim objDataSet As DataSet ' objeto Conjunto de datos
Dim sqlstr, oper As String
Dim Alumno As Boolean
#Region " Código generado por el Diseñador de Windows Forms "

Public Sub New()


MyBase.New()

'El Diseñador de Windows Forms requiere esta llamada.


InitializeComponent()

'Agregar cualquier inicialización después de la llamada a


InitializeComponent()

End Sub

'Form reemplaza a Dispose para limpiar la lista de componentes.


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Requerido por el Diseñador de Windows Forms


Private components As System.ComponentModel.IContainer

'NOTA: el Diseñador de Windows Forms requiere el siguiente procedimiento


'Puede modificarse utilizando el Diseñador de Windows Forms.
'No lo modifique con el editor de código.
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents rbtnApellidos As System.Windows.Forms.RadioButton
Friend WithEvents rbtnCodigo As System.Windows.Forms.RadioButton
Friend WithEvents txtBusqueda As System.Windows.Forms.TextBox
Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid
Friend WithEvents btnCancelar As System.Windows.Forms.Button
Friend WithEvents btnAceptar As System.Windows.Forms.Button
Friend WithEvents txtResumen As System.Windows.Forms.TextBox
Friend WithEvents lblTitulo As System.Windows.Forms.Label
Friend WithEvents rbtnTipo As System.Windows.Forms.RadioButton
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.rbtnTipo = New System.Windows.Forms.RadioButton()
Me.rbtnApellidos = New System.Windows.Forms.RadioButton()
Me.rbtnCodigo = New System.Windows.Forms.RadioButton()
Me.txtBusqueda = New System.Windows.Forms.TextBox()
Me.DataGrid1 = New System.Windows.Forms.DataGrid()
Me.btnCancelar = New System.Windows.Forms.Button()
Me.btnAceptar = New System.Windows.Forms.Button()
Me.txtResumen = New System.Windows.Forms.TextBox()
Me.lblTitulo = New System.Windows.Forms.Label()
Me.GroupBox1.SuspendLayout()
CType(Me.DataGrid1,
System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'GroupBox1
'
Me.GroupBox1.BackColor = System.Drawing.Color.Yellow
Me.GroupBox1.Controls.AddRange(New System.Windows.Forms.Control()
{Me.rbtnTipo, Me.rbtnApellidos, Me.rbtnCodigo})
Me.GroupBox1.Font = New System.Drawing.Font("Comic Sans MS", 9.75!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,
Byte))
Me.GroupBox1.ForeColor = System.Drawing.Color.Magenta
Me.GroupBox1.Location = New System.Drawing.Point(16, 16)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(216, 136)
Me.GroupBox1.TabIndex = 18
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "Busqueda por:"
'
'rbtnTipo
'
Me.rbtnTipo.Font = New System.Drawing.Font("TimelessTLig", 9.0!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,
Byte))
Me.rbtnTipo.ForeColor = System.Drawing.Color.FromArgb(CType(128,
Byte), CType(128, Byte), CType(255, Byte))
Me.rbtnTipo.Location = New System.Drawing.Point(16, 96)
Me.rbtnTipo.Name = "rbtnTipo"
Me.rbtnTipo.TabIndex = 7
Me.rbtnTipo.Text = "Tipo"
'
'rbtnApellidos
'
Me.rbtnApellidos.Font = New System.Drawing.Font("TimelessTLig", 9.0!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,
Byte))
Me.rbtnApellidos.ForeColor = System.Drawing.Color.FromArgb(CType(128,
Byte), CType(128, Byte), CType(255, Byte))
Me.rbtnApellidos.Location = New System.Drawing.Point(12, 64)
Me.rbtnApellidos.Name = "rbtnApellidos"
Me.rbtnApellidos.Size = New System.Drawing.Size(88, 16)
Me.rbtnApellidos.TabIndex = 6
Me.rbtnApellidos.Text = "Apellidos"
'
'rbtnCodigo
'
Me.rbtnCodigo.Font = New System.Drawing.Font("TimelessTLig", 9.0!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,
Byte))
Me.rbtnCodigo.ForeColor = System.Drawing.Color.FromArgb(CType(128,
Byte), CType(128, Byte), CType(255, Byte))
Me.rbtnCodigo.Location = New System.Drawing.Point(12, 24)
Me.rbtnCodigo.Name = "rbtnCodigo"
Me.rbtnCodigo.TabIndex = 5
Me.rbtnCodigo.Text = "Codigo"
'
'txtBusqueda
'
Me.txtBusqueda.Font = New System.Drawing.Font("Times New Roman",
11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.txtBusqueda.ForeColor = System.Drawing.Color.FromArgb(CType(128,
Byte), CType(128, Byte), CType(255, Byte))
Me.txtBusqueda.Location = New System.Drawing.Point(304, 64)
Me.txtBusqueda.Name = "txtBusqueda"
Me.txtBusqueda.Size = New System.Drawing.Size(200, 25)
Me.txtBusqueda.TabIndex = 17
Me.txtBusqueda.Text = ""
'
'DataGrid1
'
Me.DataGrid1.BackgroundColor =
System.Drawing.Color.FromArgb(CType(128, Byte), CType(128, Byte), CType(255,
Byte))
Me.DataGrid1.CaptionBackColor = System.Drawing.Color.Yellow
Me.DataGrid1.DataMember = ""
Me.DataGrid1.ForeColor = System.Drawing.Color.Yellow
Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGrid1.Location = New System.Drawing.Point(16, 168)
Me.DataGrid1.Name = "DataGrid1"
Me.DataGrid1.Size = New System.Drawing.Size(536, 160)
Me.DataGrid1.TabIndex = 16
'
'btnCancelar
'
Me.btnCancelar.BackColor = System.Drawing.Color.Yellow
Me.btnCancelar.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.btnCancelar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnCancelar.ForeColor = System.Drawing.Color.FromArgb(CType(128,
Byte), CType(128, Byte), CType(255, Byte))
Me.btnCancelar.Location = New System.Drawing.Point(432, 112)
Me.btnCancelar.Name = "btnCancelar"
Me.btnCancelar.TabIndex = 15
Me.btnCancelar.Text = "&Cancelar"
'
'btnAceptar
'
Me.btnAceptar.BackColor = System.Drawing.Color.Yellow
Me.btnAceptar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnAceptar.ForeColor = System.Drawing.Color.FromArgb(CType(128,
Byte), CType(128, Byte), CType(255, Byte))
Me.btnAceptar.Location = New System.Drawing.Point(312, 112)
Me.btnAceptar.Name = "btnAceptar"
Me.btnAceptar.Size = New System.Drawing.Size(80, 24)
Me.btnAceptar.TabIndex = 14
Me.btnAceptar.Text = "&Aceptar"
'
'txtResumen
'
Me.txtResumen.BackColor = System.Drawing.Color.Yellow
Me.txtResumen.Font = New System.Drawing.Font("Microsoft Sans Serif",
9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.txtResumen.ForeColor = System.Drawing.Color.FromArgb(CType(128,
Byte), CType(128, Byte), CType(255, Byte))
Me.txtResumen.Location = New System.Drawing.Point(16, 344)
Me.txtResumen.Multiline = True
Me.txtResumen.Name = "txtResumen"
Me.txtResumen.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
Me.txtResumen.Size = New System.Drawing.Size(536, 64)
Me.txtResumen.TabIndex = 13
Me.txtResumen.Text = ""
'
'lblTitulo
'
Me.lblTitulo.BackColor = System.Drawing.Color.Transparent
Me.lblTitulo.Font = New System.Drawing.Font("Microsoft Sans Serif",
9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.lblTitulo.ForeColor = System.Drawing.Color.Magenta
Me.lblTitulo.Location = New System.Drawing.Point(312, 16)
Me.lblTitulo.Name = "lblTitulo"
Me.lblTitulo.Size = New System.Drawing.Size(176, 32)
Me.lblTitulo.TabIndex = 12
'
'frmConAlumnos
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.Color.FromArgb(CType(128, Byte),
CType(128, Byte), CType(255, Byte))
Me.ClientSize = New System.Drawing.Size(576, 422)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.GroupBox1,
Me.txtBusqueda, Me.DataGrid1, Me.btnCancelar, Me.btnAceptar, Me.txtResumen,
Me.lblTitulo})
Me.Name = "frmConAlumnos"
Me.Text = "frmConAlumnos"
Me.GroupBox1.ResumeLayout(False)
CType(Me.DataGrid1,
System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub frmConAlumnos_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load
End Sub

Private Sub rbtnCodigo_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles rbtnCodigo.Click, rbtnApellidos.Click,
rbtnTipo.Click
Select Case sender.name
Case "rbtnCodigo"
strcampo = "Cod_Alumno"
oper = " codigo "
Case "rbtnApellidos"
strcampo = "Ape_Alumno"
oper = " Apellido de Alumno "
Case "rbtnTipo"
strcampo = "Tipo"
oper = " Tipo de Alumno "
End Select

Alumno = False
Me.lblTitulo.Text = "INGRESE" & oper & " A BUSCAR:"
Me.DataGrid1.DataSource = Nothing
txtBusqueda.Clear()
txtBusqueda.Focus()
txtResumen.Clear()
End Sub

Private Sub btnAceptar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnAceptar.Click
Dim strSQL, primero, ultimo As String
Dim total As Integer
strSQL = "SELECT * FROM Alumno WHERE " & Trim(strcampo) & " LIKE '" &
_
Trim(Me.txtBusqueda.Text) & "%'"
If txtBusqueda.Text = "" Then
MsgBox("INGRESE EL " & oper & " DEL Alumno A BUSCAR")
txtBusqueda.Focus()
Exit Sub
End If

'Creando objeto DataAdapter


objDataAdapter = New SqlDataAdapter(strSQL, MODCONEXION.Conexion)
MODCONEXION.Conexion.Open()
'Creando objeto DataSet
objDataSet = New DataSet()
objDataAdapter.Fill(objDataSet, "Alumno")
MODCONEXION.Conexion.Close()
'resumen de la busqueda
total = Me.objDataSet.Tables("Alumno").Rows.Count
If total > 0 Then
Me.DataGrid1.DataSource = objDataSet
Me.DataGrid1.DataMember = "Alumno"
primero = Me.objDataSet.Tables("Alumno").Rows.Item(0)(1)
ultimo = Me.objDataSet.Tables("Alumno").Rows.Item(total - 1)(1)
txtResumen.Text = "Se encontraron " & Str(total) & " Alumno" & "
desde " & primero & _
" hasta " & ultimo
Else
txtResumen.Text = "No se encontraron datos...."
End If
End Sub

Private Sub FrmConEmpleados_Closed(ByVal sender As Object, ByVal e As


System.EventArgs) Handles MyBase.Closed
MODCONEXION.FRMCE = False
End Sub

Private Sub btnCancelar_Click_1(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnCancelar.Click
Me.Close()
End Sub

Private Sub rbtnCodigo_CheckedChanged(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles rbtnCodigo.CheckedChanged

End Sub
End Class

FORMULARIO DE REPORTE DE ALUMNOS POR CAMBIO DE CENTRO, EXAMEN


ATRASADO Y CENTRO DE APOYO
Public Class frmReporte
Inherits System.Windows.Forms.Form

#Region " Código generado por el Diseñador de Windows Forms "

Public Sub New()


MyBase.New()

'El Diseñador de Windows Forms requiere esta llamada.


InitializeComponent()

'Agregar cualquier inicialización después de la llamada a


InitializeComponent()

End Sub

'Form reemplaza a Dispose para limpiar la lista de componentes.


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Requerido por el Diseñador de Windows Forms


Private components As System.ComponentModel.IContainer

'NOTA: el Diseñador de Windows Forms requiere el siguiente procedimiento


'Puede modificarse utilizando el Diseñador de Windows Forms.
'No lo modifique con el editor de código.
Friend WithEvents btnSalir As System.Windows.Forms.Button
Friend WithEvents btnSelImpresora As System.Windows.Forms.Button
Friend WithEvents btnEjecutar As System.Windows.Forms.Button
Friend WithEvents btnSeleccionar As System.Windows.Forms.Button
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents CrystalReportViewer1 As
CrystalDecisions.Windows.Forms.CrystalReportViewer
Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
Friend WithEvents PrintDocument1 As System.Drawing.Printing.PrintDocument
Friend WithEvents rbtnAlumno As System.Windows.Forms.RadioButton
Friend WithEvents rbtnCiclo As System.Windows.Forms.RadioButton
Friend WithEvents rbtnCurso As System.Windows.Forms.RadioButton
Friend WithEvents rbtnCargo As System.Windows.Forms.RadioButton
Friend WithEvents rbtnEspecialidad As System.Windows.Forms.RadioButton
Friend WithEvents rbtnFichaPagos As System.Windows.Forms.RadioButton
Friend WithEvents rbtnProfesores As System.Windows.Forms.RadioButton
Friend WithEvents rbtnPeriodoAcademico As System.Windows.Forms.RadioButton
Friend WithEvents rbtnMatricula As System.Windows.Forms.RadioButton
Friend WithEvents rbtnTeoria As System.Windows.Forms.RadioButton
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.btnSalir = New System.Windows.Forms.Button()
Me.btnSelImpresora = New System.Windows.Forms.Button()
Me.btnEjecutar = New System.Windows.Forms.Button()
Me.btnSeleccionar = New System.Windows.Forms.Button()
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.rbtnTeoria = New System.Windows.Forms.RadioButton()
Me.rbtnProfesores = New System.Windows.Forms.RadioButton()
Me.rbtnPeriodoAcademico = New System.Windows.Forms.RadioButton()
Me.rbtnMatricula = New System.Windows.Forms.RadioButton()
Me.rbtnFichaPagos = New System.Windows.Forms.RadioButton()
Me.rbtnEspecialidad = New System.Windows.Forms.RadioButton()
Me.rbtnCiclo = New System.Windows.Forms.RadioButton()
Me.rbtnCurso = New System.Windows.Forms.RadioButton()
Me.rbtnCargo = New System.Windows.Forms.RadioButton()
Me.rbtnAlumno = New System.Windows.Forms.RadioButton()
Me.Label1 = New System.Windows.Forms.Label()
Me.CrystalReportViewer1 = New
CrystalDecisions.Windows.Forms.CrystalReportViewer()
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
Me.PrintDocument1 = New System.Drawing.Printing.PrintDocument()
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'btnSalir
'
Me.btnSalir.BackColor = System.Drawing.Color.Yellow
Me.btnSalir.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnSalir.ForeColor = System.Drawing.Color.Purple
Me.btnSalir.Location = New System.Drawing.Point(624, 352)
Me.btnSalir.Name = "btnSalir"
Me.btnSalir.Size = New System.Drawing.Size(80, 40)
Me.btnSalir.TabIndex = 13
Me.btnSalir.Text = "Salir"
'
'btnSelImpresora
'
Me.btnSelImpresora.BackColor = System.Drawing.Color.Yellow
Me.btnSelImpresora.Font = New System.Drawing.Font("Microsoft Sans
Serif", 8.25!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnSelImpresora.ForeColor = System.Drawing.Color.Purple
Me.btnSelImpresora.Location = New System.Drawing.Point(472, 352)
Me.btnSelImpresora.Name = "btnSelImpresora"
Me.btnSelImpresora.Size = New System.Drawing.Size(104, 40)
Me.btnSelImpresora.TabIndex = 12
Me.btnSelImpresora.Text = "Seleccionar Tipo de Impresora"
'
'btnEjecutar
'
Me.btnEjecutar.BackColor = System.Drawing.Color.Yellow
Me.btnEjecutar.Font = New System.Drawing.Font("Microsoft Sans Serif",
8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.btnEjecutar.ForeColor = System.Drawing.Color.Purple
Me.btnEjecutar.Location = New System.Drawing.Point(320, 352)
Me.btnEjecutar.Name = "btnEjecutar"
Me.btnEjecutar.Size = New System.Drawing.Size(96, 40)
Me.btnEjecutar.TabIndex = 11
Me.btnEjecutar.Text = "Ejecutar Reporte"
'
'btnSeleccionar
'
Me.btnSeleccionar.BackColor = System.Drawing.Color.Yellow
Me.btnSeleccionar.Font = New System.Drawing.Font("Microsoft Sans
Serif", 8.25!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnSeleccionar.ForeColor = System.Drawing.Color.Purple
Me.btnSeleccionar.Location = New System.Drawing.Point(168, 352)
Me.btnSeleccionar.Name = "btnSeleccionar"
Me.btnSeleccionar.Size = New System.Drawing.Size(96, 40)
Me.btnSeleccionar.TabIndex = 10
Me.btnSeleccionar.Text = "Seleccionar Reporte"
'
'GroupBox1
'
Me.GroupBox1.Controls.AddRange(New System.Windows.Forms.Control()
{Me.rbtnTeoria, Me.rbtnProfesores, Me.rbtnPeriodoAcademico, Me.rbtnMatricula,
Me.rbtnFichaPagos, Me.rbtnEspecialidad, Me.rbtnCiclo, Me.rbtnCurso,
Me.rbtnCargo, Me.rbtnAlumno})
Me.GroupBox1.Font = New System.Drawing.Font("Microsoft Sans Serif",
9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.GroupBox1.ForeColor = System.Drawing.Color.Magenta
Me.GroupBox1.Location = New System.Drawing.Point(8, 40)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(128, 360)
Me.GroupBox1.TabIndex = 9
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "Reporte de:"
'
'rbtnTeoria
'
Me.rbtnTeoria.Font = New System.Drawing.Font("Times New Roman", 9.0!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,
Byte))
Me.rbtnTeoria.ForeColor = System.Drawing.Color.Aqua
Me.rbtnTeoria.Location = New System.Drawing.Point(16, 328)
Me.rbtnTeoria.Name = "rbtnTeoria"
Me.rbtnTeoria.TabIndex = 18
Me.rbtnTeoria.Text = "Teoría"
'
'rbtnProfesores
'
Me.rbtnProfesores.Font = New System.Drawing.Font("Times New Roman",
9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.rbtnProfesores.ForeColor = System.Drawing.Color.Aqua
Me.rbtnProfesores.Location = New System.Drawing.Point(16, 296)
Me.rbtnProfesores.Name = "rbtnProfesores"
Me.rbtnProfesores.TabIndex = 17
Me.rbtnProfesores.Text = "Ciclo"
'
'rbtnPeriodoAcademico
'
Me.rbtnPeriodoAcademico.Font = New System.Drawing.Font("Times New
Roman", 9.0!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.rbtnPeriodoAcademico.ForeColor = System.Drawing.Color.Aqua
Me.rbtnPeriodoAcademico.Location = New System.Drawing.Point(16, 248)
Me.rbtnPeriodoAcademico.Name = "rbtnPeriodoAcademico"
Me.rbtnPeriodoAcademico.Size = New System.Drawing.Size(104, 40)
Me.rbtnPeriodoAcademico.TabIndex = 16
Me.rbtnPeriodoAcademico.Text = "Ficha de Pagos"
'
'rbtnMatricula
'
Me.rbtnMatricula.Font = New System.Drawing.Font("Times New Roman",
9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.rbtnMatricula.ForeColor = System.Drawing.Color.Aqua
Me.rbtnMatricula.Location = New System.Drawing.Point(16, 216)
Me.rbtnMatricula.Name = "rbtnMatricula"
Me.rbtnMatricula.Size = New System.Drawing.Size(104, 32)
Me.rbtnMatricula.TabIndex = 15
Me.rbtnMatricula.Text = "Periodo Academico"
'
'rbtnFichaPagos
'
Me.rbtnFichaPagos.Font = New System.Drawing.Font("Times New Roman",
9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.rbtnFichaPagos.ForeColor = System.Drawing.Color.Aqua
Me.rbtnFichaPagos.Location = New System.Drawing.Point(16, 184)
Me.rbtnFichaPagos.Name = "rbtnFichaPagos"
Me.rbtnFichaPagos.TabIndex = 9
Me.rbtnFichaPagos.Text = "Profesor"
'
'rbtnEspecialidad
'
Me.rbtnEspecialidad.Font = New System.Drawing.Font("Times New Roman",
9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.rbtnEspecialidad.ForeColor = System.Drawing.Color.Aqua
Me.rbtnEspecialidad.Location = New System.Drawing.Point(16, 152)
Me.rbtnEspecialidad.Name = "rbtnEspecialidad"
Me.rbtnEspecialidad.TabIndex = 7
Me.rbtnEspecialidad.Text = "Mátricula"
'
'rbtnCiclo
'
Me.rbtnCiclo.Font = New System.Drawing.Font("Times New Roman", 9.0!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,
Byte))
Me.rbtnCiclo.ForeColor = System.Drawing.Color.Aqua
Me.rbtnCiclo.Location = New System.Drawing.Point(16, 88)
Me.rbtnCiclo.Name = "rbtnCiclo"
Me.rbtnCiclo.TabIndex = 5
Me.rbtnCiclo.Text = "Especialidad"
'
'rbtnCurso
'
Me.rbtnCurso.Font = New System.Drawing.Font("Times New Roman", 9.0!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,
Byte))
Me.rbtnCurso.ForeColor = System.Drawing.Color.Aqua
Me.rbtnCurso.Location = New System.Drawing.Point(16, 120)
Me.rbtnCurso.Name = "rbtnCurso"
Me.rbtnCurso.TabIndex = 4
Me.rbtnCurso.Text = "Empleado"
'
'rbtnCargo
'
Me.rbtnCargo.Font = New System.Drawing.Font("Times New Roman", 9.0!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,
Byte))
Me.rbtnCargo.ForeColor = System.Drawing.Color.Aqua
Me.rbtnCargo.Location = New System.Drawing.Point(16, 56)
Me.rbtnCargo.Name = "rbtnCargo"
Me.rbtnCargo.TabIndex = 3
Me.rbtnCargo.Text = "Curso"
'
'rbtnAlumno
'
Me.rbtnAlumno.Font = New System.Drawing.Font("Times New Roman", 9.0!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,
Byte))
Me.rbtnAlumno.ForeColor = System.Drawing.Color.Aqua
Me.rbtnAlumno.Location = New System.Drawing.Point(16, 24)
Me.rbtnAlumno.Name = "rbtnAlumno"
Me.rbtnAlumno.TabIndex = 0
Me.rbtnAlumno.Text = "Alumnos"
'
'Label1
'
Me.Label1.Font = New System.Drawing.Font("Times New Roman", 21.75!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,
Byte))
Me.Label1.ForeColor = System.Drawing.Color.Yellow
Me.Label1.Location = New System.Drawing.Point(232, 8)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(328, 32)
Me.Label1.TabIndex = 8
Me.Label1.Text = "REPORTE DE DATOS"
'
'CrystalReportViewer1
'
Me.CrystalReportViewer1.ActiveViewIndex = -1
Me.CrystalReportViewer1.BackColor = System.Drawing.Color.Yellow
Me.CrystalReportViewer1.Font = New System.Drawing.Font("Microsoft Sans
Serif", 9.75!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.CrystalReportViewer1.ForeColor = System.Drawing.Color.Navy
Me.CrystalReportViewer1.Location = New System.Drawing.Point(160, 48)
Me.CrystalReportViewer1.Name = "CrystalReportViewer1"
Me.CrystalReportViewer1.ReportSource = Nothing
Me.CrystalReportViewer1.Size = New System.Drawing.Size(560, 272)
Me.CrystalReportViewer1.TabIndex = 7
'
'frmReporte
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.Color.Purple
Me.ClientSize = New System.Drawing.Size(784, 414)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnSalir,
Me.btnSelImpresora, Me.btnEjecutar, Me.btnSeleccionar, Me.GroupBox1,
Me.Label1, Me.CrystalReportViewer1})
Me.Name = "frmReporte"
Me.Text = "frmReporte"
Me.GroupBox1.ResumeLayout(False)
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub btnSalir_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnSalir.Click
MsgBox("A ACCEDIDO A LOS REPORTES DE LA BASE DE DATOS")
Me.Close()
End Sub
Private Sub btnSelImpresora_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnSelImpresora.Click
Dim PrintDialog1 As New PrintDialog()
PrintDialog1.Document = PrintDocument1

Dim result As DialogResult = PrintDialog1.ShowDialog()


If (result = DialogResult.OK) Then
PrintDocument1.Print()
End If
End Sub
Private Sub btnSeleccionar_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSeleccionar.Click
OpenFileDialog1.Filter = "Crystal Report |*.rpt"
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
CrystalReportViewer1.ReportSource = OpenFileDialog1.FileName
End If
End Sub

Private Sub btnEjecutar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnEjecutar.Click
Dim s = "D:\Proyecto_Taller_II\Prototipo_Visual\"
If Me.rbtnAlumno.Checked = True Then
CrystalReportViewer1.ReportSource = s & "crystalReport1.rpt"
End If

If Me.rbtnPeriodoAcademico.Checked = True Then


CrystalReportViewer1.ReportSource = s & "CrystalReport8.rpt"
End If

If Me.rbtnFichaPagos.Checked = True Then


CrystalReportViewer1.ReportSource = s & "CrystalReport11.rpt"
End If

End Sub

Private Sub frmReporte_Closed(ByVal sender As Object, ByVal e As


System.EventArgs) Handles MyBase.Closed
MODCONEXION.FRMR = False
End Sub

Private Sub frmReporte_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load

End Sub

Private Sub rbtnAlumno_CheckedChanged(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles rbtnAlumno.CheckedChanged

End Sub

Private Sub CrystalReportViewer1_Load(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles CrystalReportViewer1.Load

End Sub

End Class

CODIGO SQL GENERADO EN LA CREACION DE LAS TABLAS


CREATE TABLE Estudiante (
Cod_Estudiante char(18) NOT NULL,
Ape_Estudiante varchar(80) NULL,
Nom_Estudiante varchar(80) NULL,
Direccion varchar(80) NULL,
Fecha_Ingreso datetime NULL,
Tipo_Estudiante char(18) NULL
)
go

ALTER TABLE Estudiante


ADD PRIMARY KEY (Cod_Estudiante)
go

CREATE TABLE Ficha_Pagos (


Num_Ficha char(18) NOT NULL,
P_Cuota money NULL,
S_Cuota money NULL,
Becado bit NULL,
Razon text NULL,
Cod_Alumno char(18) NULL,
FOREIGN KEY (Cod_Alumno)
REFERENCES Alumno
ON DELETE NO ACTION
ON UPDATE NO ACTION,
FOREIGN KEY (Cod_Empleado)
REFERENCES Empleado
ON DELETE NO ACTION
ON UPDATE NO ACTION
)
go

ALTER TABLE Ficha_Pagos


ADD PRIMARY KEY (Num_Ficha)
go

CREATE TABLE Semestre (


Periodo char(18) NOT NULL,
Fecha_Inicio datetime NULL,
Fecha_Termino datetime NULL
)
go

ALTER TABLE Semestre


ADD PRIMARY KEY (Periodo)
go
CREATE TABLE Materia (
Cod_Curso char(18) NOT NULL,
Cod_Especialidad char(18) NOT NULL,
Nom_Materia varchar(80) NULL,
ID_Teoria char(18) NULL,
FOREIGN KEY (Cod_Especialidad)
REFERENCES Especialidad
ON DELETE NO ACTION
ON UPDATE NO ACTION,
FOREIGN KEY (ID_Teoria)
REFERENCES Teoria
ON DELETE NO ACTION
ON UPDATE NO ACTION
)
go

ALTER TABLE Materia


ADD PRIMARY KEY (Cod_Curso)
go

CREATE TABLE Ciclo (


Numero_Ciclo char(18) NOT NULL,
Turno varchar(80) NULL,
Cod_Curso char(18) NULL,
Periodo char(18) NULL,
FOREIGN KEY (Periodo)
REFERENCES Periodo_Academico
ON DELETE NO ACTION
ON UPDATE NO ACTION,
FOREIGN KEY (Cod_Curso)
REFERENCES Curso
ON DELETE NO ACTION
ON UPDATE NO ACTION
)
go

ALTER TABLE Ciclo


ADD PRIMARY KEY (Numero_Ciclo)
go

CREATE TABLE Examen (


Num_Examen char(18) NOT NULL,
Cod_Empleado char(18) NULL,
Cod_Alumno char(18) NULL,
Periodo char(18) NULL,
Numero_Ciclo char(18) NULL,
FOREIGN KEY (Numero_Ciclo)
REFERENCES Ciclo
ON DELETE NO ACTION
ON UPDATE NO ACTION,
FOREIGN KEY (Periodo)
REFERENCES Periodo_Academico
ON DELETE NO ACTION
ON UPDATE NO ACTION,
FOREIGN KEY (Cod_Alumno)
REFERENCES Alumno
ON DELETE NO ACTION
ON UPDATE NO ACTION,
)
go

ALTER TABLE Examen


ADD PRIMARY KEY (Num_Matricula)
go

You might also like