Practica agustin eliminar

170 views
116 views

Published on

Ing. Agustin Hernandez Delgado

Published in: Internet, Technology, Spiritual
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
170
On SlideShare
0
From Embeds
0
Number of Embeds
18
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Practica agustin eliminar

  1. 1. Plantel Conalep Zacualpan 101 Elaboración y Mantenimiento de Sistemas de Información. Ing. Agustín Hernández Delgado. Alumno: Guadalupe Lima Pèrez Grupo. 606
  2. 2. BUSCAR Este código, realiza la acción de encontrar los datos pedidos por el programa y visualizarlos en la depuración del mismo. Codigo. PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click REM CONSULTAS Dim mitabla AsDataTable = CODREP_________________________________DataSet.ALUMNO Dim cfilas AsDataRowCollection = mitabla.Rows Dim nuevafila AsDataRow Dim i AsInteger Dim n AsInteger n = ALUMNOBindingSource.Count() Dim bandera AsBoolean bandera = True Dim tamaño AsInteger tamaño = ALUMNOBindingSource.Count() i = 1 If (tamaño = 0) Then Else Do If (Trim(MATRICULATextBox.Text) = Trim(TextBox1.Text)) Then bandera = False Else ALUMNOBindingSource.MoveNext() i = i + 1 EndIf LoopWhile (bandera = TrueAnd i <= tamaño) EndIf If (bandera = False) Then ID_ALUMNOTextBox.Enabled = False ID_ALUMNOTextBox.Visible = False NOMBRETextBox.Enabled = False NOMBRETextBox.Visible = False APELLIDOSTextBox.Enabled = False APELLIDOSTextBox.Visible = False MATRICULATextBox.Enabled = False
  3. 3. MATRICULATextBox.Visible = False ESPECIALIDADTextBox.Enabled = False ESPECIALIDADTextBox.Visible = False TURNOTextBox.Enabled = False TURNOTextBox.Visible = False GRUPOTextBox.Enabled = False GRUPOTextBox.Visible = False TELEFONOTextBox.Enabled = False TELEFONOTextBox.Visible = False CORREOTextBox.Enabled = False CORREOTextBox.Visible = False MsgBox("Ya existe") TextBox1.Text = "" TextBox1.Focus() Else MsgBox("Introduce datos") nuevafila = mitabla.NewRow cfilas.Add(nuevafila) ALUMNOBindingSource.MoveLast() ID_ALUMNOTextBox.Enabled = True ID_ALUMNOTextBox.Visible = True NOMBRETextBox.Enabled = True NOMBRETextBox.Visible = True APELLIDOSTextBox.Enabled = True APELLIDOSTextBox.Visible = True MATRICULATextBox.Enabled = True MATRICULATextBox.Visible = True ESPECIALIDADTextBox.Enabled = True ESPECIALIDADTextBox.Visible = True TURNOTextBox.Enabled = True TURNOTextBox.Visible = True GRUPOTextBox.Enabled = True GRUPOTextBox.Visible = True TELEFONOTextBox.Enabled = True TELEFONOTextBox.Visible = True CORREOTextBox.Enabled = True CORREOTextBox.Visible = True nuevafila(1) = UCase(NOMBRETextBox.Text)
  4. 4. nuevafila(2) = UCase(APELLIDOSTextBox.Text) nuevafila(3) = UCase(TextBox1.Text) nuevafila(4) = UCase(ESPECIALIDADTextBox.Text) nuevafila(5) = UCase(TURNOTextBox.Text) nuevafila(6) = UCase(GRUPOTextBox.Text) nuevafila(7) = UCase(TELEFONOTextBox.Text) nuevafila(8) = UCase(CORREOTextBox.Text) EndIf EndSub GRABAR Se encarga de guardar, documentos recientemente insertados y/o actualizados. Código. PrivateSub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If (CODREP_________________________________DataSet.HasChanges) Then Me.Validate() Me.ALUMNOBindingSource.EndEdit() Me.ALUMNOTableAdapter.Update(Me.CODREP_________________________________Data Set.ALUMNO) MsgBox("Cargando") TextBox1.Text = "" TextBox1.Focus() ID_ALUMNOTextBox.Enabled = False NOMBRETextBox.Enabled = False APELLIDOSTextBox.Enabled = False MATRICULATextBox.Enabled = False ESPECIALIDADTextBox.Enabled = False TURNOTextBox.Enabled = False GRUPOTextBox.Enabled = False TELEFONOTextBox.Enabled = False CORREOTextBox.Enabled = False
  5. 5. EndIf EndSub ELIMINAR Suprime datos no deseados . Codigo. PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click REM CONSULTAS Dim mitabla AsDataTable = CODREP_________________________________DataSet.ALUMNO Dim cfilas AsDataRowCollection = mitabla.Rows Dim nuevafila AsDataRow Dim i AsInteger Dim n AsInteger n = ALUMNOBindingSource.Count() Dim bandera AsBoolean bandera = True Dim tamaño AsInteger tamaño = ALUMNOBindingSource.Count() i = 1 If (tamaño = 0) Then Else Do If (Trim(MATRICULATextBox.Text) = Trim(TextBox1.Text)) Then bandera = False Else ALUMNOBindingSource.MoveNext() i = i + 1 EndIf LoopWhile (bandera = TrueAnd i <= tamaño) EndIf If (bandera = False) Then ID_ALUMNOTextBox.Enabled = False ID_ALUMNOTextBox.Visible = False
  6. 6. NOMBRETextBox.Enabled = False NOMBRETextBox.Visible = False APELLIDOSTextBox.Enabled = False APELLIDOSTextBox.Visible = False MATRICULATextBox.Enabled = False MATRICULATextBox.Visible = False ESPECIALIDADTextBox.Enabled = False ESPECIALIDADTextBox.Visible = False TURNOTextBox.Enabled = False TURNOTextBox.Visible = False GRUPOTextBox.Enabled = False GRUPOTextBox.Visible = False TELEFONOTextBox.Enabled = False TELEFONOTextBox.Visible = False CORREOTextBox.Enabled = False CORREOTextBox.Visible = False MsgBox("Ya existe") TextBox1.Text = "" TextBox1.Focus() Else MsgBox("Nuevos datos") nuevafila = mitabla.NewRow cfilas.Add(nuevafila) ALUMNOBindingSource.MoveLast() ID_ALUMNOTextBox.Enabled = True ID_ALUMNOTextBox.Visible = True NOMBRETextBox.Enabled = True NOMBRETextBox.Visible = True APELLIDOSTextBox.Enabled = True APELLIDOSTextBox.Visible = True MATRICULATextBox.Enabled = True MATRICULATextBox.Visible = True ESPECIALIDADTextBox.Enabled = True ESPECIALIDADTextBox.Visible = True TURNOTextBox.Enabled = True TURNOTextBox.Visible = True GRUPOTextBox.Enabled = True GRUPOTextBox.Visible = True TELEFONOTextBox.Enabled = True TELEFONOTextBox.Visible = True
  7. 7. CORREOTextBox.Enabled = True CORREOTextBox.Visible = True nuevafila(1) = UCase(NOMBRETextBox.Text) nuevafila(2) = UCase(APELLIDOSTextBox.Text) nuevafila(3) = UCase(TextBox1.Text) nuevafila(4) = UCase(ESPECIALIDADTextBox.Text) nuevafila(5) = UCase(TURNOTextBox.Text) nuevafila(6) = UCase(GRUPOTextBox.Text) nuevafila(7) = UCase(TELEFONOTextBox.Text) nuevafila(8) = UCase(CORREOTextBox.Text) EndIf EndSub PrivateSub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If (CODREP_________________________________DataSet.HasChanges) Then Me.Validate() Me.ALUMNOBindingSource.EndEdit() Me.ALUMNOTableAdapter.Update(Me.CODREP_________________________________Data Set.ALUMNO) MsgBox("Cargando") TextBox1.Text = "" TextBox1.Focus() ID_ALUMNOTextBox.Enabled = False NOMBRETextBox.Enabled = False APELLIDOSTextBox.Enabled = False MATRICULATextBox.Enabled = False ESPECIALIDADTextBox.Enabled = False TURNOTextBox.Enabled = False GRUPOTextBox.Enabled = False TELEFONOTextBox.Enabled = False CORREOTextBox.Enabled = False EndIf EndSub PrivateSub SALIR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SALIR.Click End EndSub PrivateSub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) EndSub
  8. 8. PrivateSub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged TextBox1.Focus() EndSub PrivateSub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If (CODREP_________________________________DataSet.HasChanges) Then Me.Validate() Me.ALUMNOBindingSource.EndEdit() Me.ALUMNOTableAdapter.Update(Me.CODREP_________________________________Data Set.ALUMNO) MsgBox("Cargando") TextBox1.Text = "" TextBox1.Focus() ID_ALUMNOTextBox.Enabled = False NOMBRETextBox.Enabled = False APELLIDOSTextBox.Enabled = False MATRICULATextBox.Enabled = False ESPECIALIDADTextBox.Enabled = False TURNOTextBox.Enabled = False GRUPOTextBox.Enabled = False TELEFONOTextBox.Enabled = False CORREOTextBox.Enabled = False EndIf EndSub

×