botón elimanr grabar etc

7
2014 Equipo-CODRED 15/05/2014 Conalep zacualpan 101 Elaboración y mantenimiento de sistemas de información 606 Anayenzi Perez Mena Profesor:Ing.Agustin Hernández Delgado

Upload: anayenzi-perez-mena

Post on 25-Jun-2015

65 views

Category:

Spiritual


2 download

TRANSCRIPT

Page 1: Botón elimanr grabar etc

Equipo-CODRED

15/05/2014

2014Conalep zacualpan 101

Elaboración y mantenimiento de sistemas de información

606Anayenzi Perez Mena

Profesor:Ing.Agustin Hernández Delgado

Page 2: Botón elimanr grabar etc

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

Page 3: Botón elimanr grabar etc

Anayenzi Perez Mena-- 606

ESPECIALIDADTextBox.Visible = False GRUPOTextBox.Visible = False TURNOTextBox.Visible = False

MATRICULATextBox.Enabled = False NOMBRETextBox.Enabled = False APELLIDOTextBox.Enabled = False ESPECIALIDADTextBox.Enabled = False GRUPOTextBox.Enabled = False TURNOTextBox.Enabled = False MsgBox("Ya existe")

TextBox1.Text = "" TextBox1.Focus()

Else MsgBox("Introduce datos") nuevafila = mitabla.NewRow cfilas.Add(nuevafila) ALTASBindingSource.MoveLast()

MATRICULATextBox.Enabled = True MATRICULATextBox.Visible = True ID_ALTATextBox.Enabled = True ID_ALTATextBox.Visible = True NOMBRETextBox.Enabled = True NOMBRETextBox.Visible = True APELLIDOTextBox.Enabled = True APELLIDOTextBox.Visible = True ESPECIALIDADTextBox.Enabled = True ESPECIALIDADTextBox.Visible = True GRUPOTextBox.Enabled = True GRUPOTextBox.Visible = True GRUPOTextBox.Enabled = True GRUPOTextBox.Visible = True TURNOTextBox.Enabled = True TURNOTextBox.Visible = True

nuevafila(1) = UCase(MATRICULATextBox.Text) nuevafila(2) = UCase(ID_ALTATextBox.Text) nuevafila(3) = UCase(TextBox1.Text) nuevafila(4) = UCase(NOMBRETextBox.Text) nuevafila(5) = UCase(APELLIDOTextBox.Text) nuevafila(6) = UCase(ESPECIALIDADTextBox.Text) nuevafila(7) = UCase(GRUPOTextBox.Text) nuevafila(8) = UCase(TURNOTextBox.Text) End If

End Sub

Page 4: Botón elimanr grabar etc

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

Equipo-4, 15/05/14,
Mi código es correcto ya no tiene errores pero al ejecutarlo se cierra y me marca esto…
Page 5: Botón elimanr grabar etc

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

Page 6: Botón elimanr grabar etc

Anayenzi Perez Mena-- 606

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() 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

Page 7: Botón elimanr grabar etc

Anayenzi Perez Mena-- 606

End Sub