Está en la página 1de 2

Practica 4 | ALBERTO JESUS ESCOBAR GUARDIA

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles MyBase.Load
'TODO: This line of code loads data into the 'Practica_4_ProgramacionDataSet.Alumnos'
table. You can move, or remove it, as needed.
Me.AlumnosTableAdapter.Fill(Me.Practica_4_ProgramacionDataSet.Alumnos)

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button1.Click
'Este boton es el de agregar'
Dim Fila As Byte
Dim Registro As DataRow
Registro = Me.Practica_4_ProgramacionDataSet.Tables("Alumnos").NewRow
Registro("Registro") = TextBox1.Text
Registro("Apellido") = TextBox2.Text
Registro("Nombre") = TextBox3.Text

Fila = DataGridView1.RowCount

Me.Practica_4_ProgramacionDataSet.Tables("Alumnos").Rows.InsertAt(Registro, Fila)
Me.AlumnosTableAdapter.Update(Me.Practica_4_ProgramacionDataSet)

DataGridView1.Update()

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button2.Click
'Este boton es el de modificar'
Dim Posicion As Byte
Pgina 1 | 2
Practica 4 | ALBERTO JESUS ESCOBAR GUARDIA

Dim xAdapter As New Global.System.Data.OleDb.OleDbDataAdapter


Posicion = TextBox4.Text - 1

Me.Practica_4_ProgramacionDataSet.Tables("Alumnos").Rows(Posicion).Item("Registro")
= TextBox1.Text
Me.Practica_4_ProgramacionDataSet.Tables("Alumnos").Rows(Posicion).Item("Apellido")
= TextBox2.Text
Me.Practica_4_ProgramacionDataSet.Tables("Alumnos").Rows(Posicion).Item("Nombre")
= TextBox3.Text
Me.AlumnosTableAdapter.Update(Me.Practica_4_ProgramacionDataSet)

DataGridView1.Update()

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button3.Click
'Este boton es para eliminar'
Dim Posicion As Byte
Dim Tabla As New Data.DataTable

Posicion = TextBox4.Text - 1

Me.Practica_4_ProgramacionDataSet.Tables("Alumnos").Rows(Posicion).Delete()
Me.AlumnosTableAdapter.Update(Me.Practica_4_ProgramacionDataSet)

DataGridView1.Update()

End Sub
End Class

Pgina 2 | 2

También podría gustarte