This document contains code for searching for existing data and saving data in a database table for a school project on managing pre-school programs. The search code loops through records in a data table to check if input data matches existing records. If a match is found, it enables editing of the form, else it adds a new row. The save code validates the form, updates the data source and database table if changes exist, and disables editing after saving.
1 of 5
Download to read offline
More Related Content
Controldepracticas
1. COLEGIO DE EDUCACION PROFESIONAL
TECNICA DEL ESTADO DE TLAXCALA
INTEGRANTES:
ESPINOSA SANCHEZ MIRIAM
Docente: ING. AGUSTN HERNNDEZ DELGADO
PROYECTO: CONTROL DE PARAESCOLAR
MODULO: ELABORACIN Y MANTENIMIENTO DE SISTEMAS DE
INFORMACIN
ESPECIALIDAD: INFORMTICA
GRADO: 6尊 SEMESTREGRUPO: 603
2. C坦digo para b炭squeda de datos existentes
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Dim mitabla As DataTable = ParaescolarDataSet.altas
Dim cfilas As DataRowCollection = mitabla.Rows
Dim nuevafila As DataRow
Dim i As Integer
Dim bandera As Boolean
bandera = True
Dim tamano As Integer
AltasBindingSource.MoveFirst()
tamano = AltasBindingSource.Count()
Dim res As Boolean
Dim a As String
Dim b As String
a = UCase(Trim(MatriculaTextBox.Text))
b = UCase(Trim(TextBox1.Text))
If (tamano = 0) Then
MsgBox("Tabla Vacia")
Else
AltasBindingSource.MoveFirst()
a = UCase(Trim(MatriculaTextBox.Text))
Do
res = a Like b
If (res = True) Then
bandera = False
Else
AltasBindingSource.MoveNext()
a = UCase(Trim(MatriculaTextBox.Text))
i = i + 1
End If
Loop While (bandera = True And i <= tamano)
End If
If (bandera = False) Then
IdTextBox.Visible = True
MatriculaTextBox.Visible = True
Nombre_compTextBox1.Visible = True
GrupoTextBox.Visible = True
EspecialidadTextBox.Visible = True
Nom_paraescolarTextBox.Visible = True
Nom_profTextBox.Visible = True
4. End If
End Sub
C坦digo para el bot坦n grabar
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
If (ParaescolarDataSet.HasChanges) Then
Me.Validate()
Me.AltasBindingSource.EndEdit()
Me.AltasTableAdapter.Update(Me.ParaescolarDataSet.altas)
MsgBox("Grabado")
IdTextBox.Enabled = False
MatriculaTextBox.Enabled = False
Nombre_compTextBox1.Enabled = False
GrupoTextBox.Enabled = False
EspecialidadTextBox.Enabled = False
Nom_paraescolarTextBox.Enabled = False
Nom_profTextBox.Enabled = False
Fech_inicioDateTimePicker.Enabled = False
End If
End Sub