2. Anayenzi Perez Mena-- 606
○Botón Consultar○
REM consultas
Dim mitabla As DataTable =
CODREP_________________________________DataSet.ALTAS
Dim cfilas As DataRowCollection = mitabla.Rows
Dim nuevafila As DataRow
Dim i As Integer
Dim n As String
n = ALTASBindingSource.Count()
Dim bandera As Boolean
bandera = True
Dim tamaño As Integer
tamaño = ALTASBindingSource.Count()
i = 1
If (tamaño = 0) Then
Else
Do
If (Trim(MATRICULATextBox.Text) = Trim(TextBox1.Text)) Then
bandera = False
Else
ALTASBindingSource.MoveNext()
i = i + 1
End If
Loop While (bandera = True And i <= tamaño)
End If
If (bandera = False) Then
MATRICULATextBox.Visible = False
NOMBRETextBox.Visible = False
APELLIDOTextBox.Visible = False
4. Anayenzi Perez Mena-- 606
○Botón eliminar○
Dim response As MsgBoxResult
Dim MSG As String
Dim TITULO As String
Dim ESTILO As MsgBoxStyle
Dim registroactual As DataRowView
ESTILO = MsgBoxStyle.YesNo
TITULO = "Borrando..."
MSG = " ¿Desea Borrar Los Datos.?"
Dim c1 As String
Dim c2 As String
Dim res As Boolean
Dim bandera As Boolean
bandera = True
Dim SI As Integer
SI = SI
Dim tam As Integer
tam = ALTASBindingSource.Count()
ALTASBindingSource.MoveFirst()
res = False
c1 = RTrim(TextBox1.Text)
c2 = RTrim(MATRICULATextBox.Text)
If (tam = 0) Then
MsgBox("tabla vacia")
Else
ALTASBindingSource.MoveFirst()
c1 = UCase(Trim(MATRICULATextBox.Text))
Do
5. Anayenzi Perez Mena-- 606
res = c1 Like c2
If (res = True) Then
bandera = False
Else
ALTASBindingSource.MoveNext()
c1 = UCase(Trim(MATRICULATextBox.Text))
SI += 1
End If
Loop While (bandera = True And SI <= tam)
End If
If (bandera = True) Then
MATRICULATextBox.Enabled = False
MATRICULATextBox.Visible = False
NOMBRETextBox.Enabled = False
NOMBRETextBox.Visible = False
APELLIDOTextBox.Enabled = False
APELLIDOTextBox.Visible = False
TURNOTextBox.Enabled = False
TURNOTextBox.Visible = False
GRUPOTextBox.Enabled = False
GRUPOTextBox.Visible = False
ESPECIALIDADTextBox.Enabled = False
ESPECIALIDADTextBox.Visible = False
TextBox1.Text = ""
TextBox1.Focus()
MsgBox("Alumno No Encontrado")
Else
MATRICULATextBox.Enabled = False
MATRICULATextBox.Visible = True
NOMBRETextBox.Enabled = False
NOMBRETextBox.Visible = True
APELLIDOTextBox.Enabled = False
APELLIDOTextBox.Visible = True
TURNOTextBox.Enabled = False
TURNOTextBox.Visible = True
GRUPOTextBox.Enabled = False
GRUPOTextBox.Visible = True
ESPECIALIDADTextBox.Enabled = False
ESPECIALIDADTextBox.Visible = True
TextBox1.Text = ""
TextBox1.Focus()
response = MsgBox(MSG, ESTILO, TITULO)
If (response = MsgBoxResult.Yes) Then
registroactual = ALTASBindingSource.Current
registroactual.Row.Delete()
Me.ALTASTableAdapter.Update(Me.CODREP_________________________________DataSet.ALTAS)
MsgBox("Se Borro EL Registro De la Tabla..")
MATRICULATextBox.Enabled = False
MATRICULATextBox.Visible = False
NOMBRETextBox.Enabled = False
6. Anayenzi Perez Mena-- 606
NOMBRETextBox.Visible = False
APELLIDOTextBox.Enabled = False
APELLIDOTextBox.Visible = False
TURNOTextBox.Enabled = False
TURNOTextBox.Visible = False
GRUPOTextBox.Enabled = False
GRUPOTextBox.Visible = False
ESPECIALIDADTextBox.Enabled = False
ESPECIALIDADTextBox.Visible = False
TextBox1.Text = ""
TextBox1.Focus()
Else
MATRICULATextBox.Enabled = False
MATRICULATextBox.Visible = False
NOMBRETextBox.Enabled = False
NOMBRETextBox.Visible = False
APELLIDOTextBox.Enabled = False
APELLIDOTextBox.Visible = False
TURNOTextBox.Enabled = False
TURNOTextBox.Visible = False
GRUPOTextBox.Enabled = False
GRUPOTextBox.Visible = False
ESPECIALIDADTextBox.Enabled = False
ESPECIALIDADTextBox.Visible = False
TextBox1.Text = ""
TextBox1.Focus()
MsgBox("NO SE HA BORRADO EL REGISTRO DE LA TABLA...")
End If
End If
End Sub
○Grabando Ahora○
If (CODREP_________________________________DataSet.HasChanges) Then
Me.Validate()
Me.ALTASBindingSource.EndEdit()
Me.ALTASTableAdapter.Update(Me.BaseCODREPDataSet.ALTAS)
MsgBox("Datos Grabando ahora")
TextBox1.Text = ""
TextBox1.Focus()
MATRICULATextBox.Enabled = False
NOMBRETextBox.Enabled = False
APELLIDOTextBox.Enabled = False
ESPECIALIDADTextBox.Enabled = False
GRUPOTextBox.Enabled = False
End If
End Sub