You are on page 1of 14

Imports System.Data.

SqlClient
Public Class Form1
Public cn As New SqlConnection
Public da1 As SqlDataAdapter
Public ds1 As New DataSet
Public dv1 As New DataView
Public objCM As SqlCommandBuilder
Public fila As DataRow
Dim indice As Integer
Dim totr As Integer
Dim nr As Integer

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


System.EventArgs) Handles MyBase.Load
'cn = New
SqlConnection("server=(local);uid=sa;password=123;database=bdventas")
cn = New SqlConnection("Data Source=.;Initial Catalog=bdventas;Integrated
Security=True")
cn.Open()
da1 = New SqlDataAdapter("SELECT codigo,nombre,edad,sueldo From
vendedor", cn)
objCM = New SqlCommandBuilder(da1)
da1.Fill(ds1, "vendedor")
dv1 = ds1.Tables("vendedor").DefaultView
dv1.AllowNew = True
dv1.AllowEdit = True
dv1.AllowDelete = True
DataGridView1.DataSource = dv1
nr = ds1.Tables(0).DefaultView.Count
indice = 0
If nr > 0 Then
selecciona(btnprimero)
End If
End Sub
Sub selecciona(ByVal btn As Button)
'mostrar nro de registro
Dim totr As Integer = nr - 1
If btn Is btnprimero Then
indice = 0
ElseIf btn Is btnanterior Then
indice -= 1
If indice > totr Then indice = totr
ElseIf btn Is btnsiguiente Then
indice += 1
If indice < totr Then indice = 0
Else
indice = totr
End If
muestradatos(indice)
TextBox5.Text = (indice + 1).ToString & "/" & nr
End Sub
Sub muestradatos(ByVal nro As Integer)
'mostrar registro
fila = ds1.Tables("vendedor").Rows(nro)
TextBox1.Text = fila.Item(0)
TextBox2.Text = fila.Item(1)
TextBox3.Text = fila.Item(2)
TextBox4.Text = fila.Item(3)
End Sub
Sub asigna()
'asignar items
fila.Item(0) = TextBox1.Text
fila.Item(1) = TextBox2.Text
fila.Item(2) = TextBox3.Text
fila.Item(3) = TextBox4.Text
End Sub

Private Sub btnnuevo_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnnuevo.Click
'agregar nuevo registro
Dim x As Control
Dim xcod As String
For Each x In Me.Controls
If TypeOf x Is TextBox Then x.Text = ""
Next
totr = ds1.Tables(0).DefaultView.Count
If totr > 0 Then
xcod = ds1.Tables(0).Rows(nr - 1).Item(0)
xcod = "V" + Format(Val(xcod.Substring(1, 3)) + 1, "000")
Else
xcod = "v001"
End If
TextBox1.Text = xcod
TextBox2.Focus()
End Sub

Private Sub btnguardar_Click(ByVal sender As Object, ByVal e As


System.EventArgs) Handles btnguardar.Click
'guardar registro
fila = ds1.Tables(0).NewRow
asigna()
ds1.Tables(0).Rows.Add(fila)
da1.Update(ds1.Tables("vendedor"))
nr = ds1.Tables(0).DefaultView.Count
selecciona(btnultimo)
End Sub

Private Sub btncancelar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btncancelar.Click
Dim x As Control
For Each x In Me.Controls
If TypeOf x Is TextBox Then x.Text = ""
Next
End Sub

Private Sub btneliminar_Click(ByVal sender As Object, ByVal e As


System.EventArgs) Handles btneliminar.Click
If indice > 0 Then
dv1.Delete(indice)
da1.Update(ds1.Tables("vendedor"))
nr = ds1.Tables(0).DefaultView.Count()
selecciona(btnultimo)
End If
End Sub

Private Sub HandlesClick(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnprimero.Click, btnanterior.Click,
btnsiguiente.Click, btnultimo.Click
selecciona(CType(sender, Button))
End Sub

End Class
Imports System.Data
Imports System.Data.SqlClient
Public Class Form5
Public cn As New SqlConnection
Public da1 As SqlDataAdapter
Public ds1 As New DataSet
Public dv1 As New DataView
Public objCM As SqlCommandBuilder
Public fila As DataRow
Dim indice As Integer
Dim totr As Integer
Dim nr As Integer
Private Sub Form5_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'cn = New
SqlConnection("server=(local);uid=sa;password=123;database=polleria")
cn = New SqlConnection("Data Source=.;Initial Catalog=polleria;Integrated
Security=True")
cn.Open()
da1 = New SqlDataAdapter("SELECT coddet,cant,importe,nrofact,codpro From
detalle", cn)
objCM = New SqlCommandBuilder(da1)
da1.Fill(ds1, "detalle")
dv1 = ds1.Tables("detalle").DefaultView
dv1.AllowNew = True
dv1.AllowEdit = True
dv1.AllowDelete = True
DataGridView1.DataSource = dv1
nr = ds1.Tables(0).DefaultView.Count
indice = 0
If nr > 0 Then
selecciona(btnprimero)
End If

End Sub

Sub selecciona(ByVal btn As Button)


'mostrar nro de registro
Dim totr As Integer = nr - 1
If btn Is btnprimero Then
indice = 0
ElseIf btn Is btnanterior Then
indice -= 1
If indice > totr Then indice = totr
ElseIf btn Is btnsiguiente Then
indice += 1
If indice < totr Then indice = 0
Else
indice = totr
End If
muestradatos(indice)
TextBox6.Text = (indice + 1).ToString & "/" & nr
End Sub

Sub muestradatos(ByVal nro As Integer)


'mostrar registro
fila = ds1.Tables("detalle").Rows(nro)
TextBox1.Text = fila.Item(0)
TextBox2.Text = fila.Item(1)
TextBox3.Text = fila.Item(2)
TextBox4.Text = fila.Item(3)
TextBox5.Text = fila.Item(4)
End Sub
Sub asigna()
'asignar items
fila.Item(0) = TextBox1.Text
fila.Item(1) = TextBox2.Text
fila.Item(2) = TextBox3.Text
fila.Item(3) = TextBox4.Text
fila.Item(4) = TextBox5.Text

End Sub

Private Sub btnnuevo_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnnuevo.Click
'agregar nuevo registro
Dim x As Control
Dim xcod As String
For Each x In Me.Controls
If TypeOf x Is TextBox Then x.Text = ""
Next
totr = ds1.Tables(0).DefaultView.Count
If totr > 0 Then
xcod = ds1.Tables(0).Rows(nr - 1).Item(0)
xcod = "D" + Format(Val(xcod.Substring(1, 3)) + 1, "000")
Else
xcod = "D001"
End If
TextBox1.Text = xcod
TextBox2.Focus()

End Sub

Private Sub btnguardar_Click(ByVal sender As Object, ByVal e As


System.EventArgs) Handles btnguardar.Click
'guardar registro
fila = ds1.Tables(0).NewRow
asigna()
ds1.Tables(0).Rows.Add(fila)
da1.Update(ds1.Tables("detalle"))
nr = ds1.Tables(0).DefaultView.Count
selecciona(btnultimo)

End Sub

Private Sub btncancelar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btncancelar.Click
Dim x As Control
For Each x In Me.Controls
If TypeOf x Is TextBox Then x.Text = ""
Next

End Sub

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


Handles btneliminar.Click
If indice > 0 Then
dv1.Delete(indice)
da1.Update(ds1.Tables("detalle"))
nr = ds1.Tables(0).DefaultView.Count()
selecciona(btnultimo)
End If
End Sub

Private Sub btnsalir_Click(sender As Object, e As EventArgs) Handles


btnsalir.Click
End

End Sub
Private Sub HandlesClick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnprimero.Click, btnanterior.Click,
btnsiguiente.Click, btnultimo.Click
selecciona(CType(sender, Button))
End Sub
End Class

Imports System.Data
Imports System.Data.SqlClient
Public Class Form4
Public cn As New SqlConnection
Public da1 As SqlDataAdapter
Public ds1 As New DataSet
Public dv1 As New DataView
Public objCM As SqlCommandBuilder
Public fila As DataRow
Dim indice As Integer
Dim totr As Integer
Dim nr As Integer
Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'cn = New
SqlConnection("server=(local);uid=sa;password=123;database=polleria")
cn = New SqlConnection("Data Source=.;Initial Catalog=polleria;Integrated
Security=True")
cn.Open()
da1 = New SqlDataAdapter("SELECT codpro,tipo,descrip,precio From
productos", cn)
objCM = New SqlCommandBuilder(da1)
da1.Fill(ds1, "productos")
dv1 = ds1.Tables("productos").DefaultView
dv1.AllowNew = True
dv1.AllowEdit = True
dv1.AllowDelete = True
DataGridView1.DataSource = dv1
nr = ds1.Tables(0).DefaultView.Count
indice = 0
If nr > 0 Then
selecciona(btnprimero)
End If

End Sub
Sub selecciona(ByVal btn As Button)
'mostrar nro de registro
Dim totr As Integer = nr - 1
If btn Is btnprimero Then
indice = 0
ElseIf btn Is btnanterior Then
indice -= 1
If indice > totr Then indice = totr
ElseIf btn Is btnsiguiente Then
indice += 1
If indice < totr Then indice = 0
Else
indice = totr
End If
muestradatos(indice)
TextBox5.Text = (indice + 1).ToString & "/" & nr
End Sub

Sub muestradatos(ByVal nro As Integer)


'mostrar registro
fila = ds1.Tables("productos").Rows(nro)
TextBox1.Text = fila.Item(0)
TextBox2.Text = fila.Item(1)
TextBox3.Text = fila.Item(2)
TextBox4.Text = fila.Item(3)

End Sub
Sub asigna()
'asignar items
fila.Item(0) = TextBox1.Text
fila.Item(1) = TextBox2.Text
fila.Item(2) = TextBox3.Text
fila.Item(3) = TextBox4.Text

End Sub

Private Sub btnnuevo_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnnuevo.Click
'agregar nuevo registro
Dim x As Control
Dim xcod As String
For Each x In Me.Controls
If TypeOf x Is TextBox Then x.Text = ""
Next
totr = ds1.Tables(0).DefaultView.Count
If totr > 0 Then
xcod = ds1.Tables(0).Rows(nr - 1).Item(0)
xcod = "P" + Format(Val(xcod.Substring(1, 3)) + 1, "000")
Else
xcod = "p001"
End If
TextBox1.Text = xcod
TextBox2.Focus()

End Sub

Private Sub btnguardar_Click(ByVal sender As Object, ByVal e As


System.EventArgs) Handles btnguardar.Click
'guardar registro
fila = ds1.Tables(0).NewRow
asigna()
ds1.Tables(0).Rows.Add(fila)
da1.Update(ds1.Tables("productos"))
nr = ds1.Tables(0).DefaultView.Count
selecciona(btnultimo)

End Sub

Private Sub btncancelar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btncancelar.Click
Dim x As Control
For Each x In Me.Controls
If TypeOf x Is TextBox Then x.Text = ""
Next

End Sub

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


Handles btneliminar.Click
If indice > 0 Then
dv1.Delete(indice)
da1.Update(ds1.Tables("producto"))
nr = ds1.Tables(0).DefaultView.Count()
selecciona(btnultimo)
End If

End Sub

Private Sub btnsalir_Click(sender As Object, e As EventArgs) Handles


btnsalir.Click
End
End Sub

Private Sub HandlesClick(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnprimero.Click, btnanterior.Click,
btnsiguiente.Click, btnultimo.Click
selecciona(CType(sender, Button))
End Sub

End Class

Imports System.Data
Imports System.Data.SqlClient
Public Class Form3
Public cn As New SqlConnection
Public da1 As SqlDataAdapter
Public ds1 As New DataSet
Public dv1 As New DataView
Public objCM As SqlCommandBuilder
Public fila As DataRow
Dim indice As Integer
Dim totr As Integer
Dim nr As Integer
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'cn = New
SqlConnection("server=(local);uid=sa;password=123;database=polleria")
cn = New SqlConnection("Data Source=.;Initial Catalog=polleria;Integrated
Security=True")
cn.Open()
da1 = New SqlDataAdapter("SELECT
nrofact,femision,fpago,subtotal,igv,total,codcli,codemp From factura", cn)
objCM = New SqlCommandBuilder(da1)
da1.Fill(ds1, "factura")
dv1 = ds1.Tables("factura").DefaultView
dv1.AllowNew = True
dv1.AllowEdit = True
dv1.AllowDelete = True
DataGridView1.DataSource = dv1
nr = ds1.Tables(0).DefaultView.Count
indice = 0
If nr > 0 Then
selecciona(btnprimero)
End If

End Sub
Sub selecciona(ByVal btn As Button)
'mostrar nro de registro
Dim totr As Integer = nr - 1
If btn Is btnprimero Then
indice = 0
ElseIf btn Is btnanterior Then
indice -= 1
If indice > totr Then indice = totr
ElseIf btn Is btnsiguiente Then
indice += 1
If indice < totr Then indice = 0
Else
indice = totr
End If
muestradatos(indice)
TextBox9.Text = (indice + 1).ToString & "/" & nr
End Sub

Sub muestradatos(ByVal nro As Integer)


'mostrar registro
fila = ds1.Tables("factura").Rows(nro)
TextBox1.Text = fila.Item(0)
TextBox2.Text = fila.Item(1)
TextBox3.Text = fila.Item(2)
TextBox4.Text = fila.Item(3)
TextBox5.Text = fila.Item(4)
TextBox6.Text = fila.Item(5)
TextBox7.Text = fila.Item(6)
TextBox8.Text = fila.Item(7)

End Sub
Sub asigna()
'asignar items
fila.Item(0) = TextBox1.Text
fila.Item(1) = TextBox2.Text
fila.Item(2) = TextBox3.Text
fila.Item(3) = TextBox4.Text
fila.Item(4) = TextBox5.Text
fila.Item(5) = TextBox6.Text
fila.Item(6) = TextBox7.Text
fila.Item(7) = TextBox8.Text

End Sub

Private Sub btnnuevo_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnnuevo.Click
'agregar nuevo registro
Dim x As Control
Dim xcod As String
For Each x In Me.Controls
If TypeOf x Is TextBox Then x.Text = ""
Next
totr = ds1.Tables(0).DefaultView.Count
If totr > 0 Then
xcod = ds1.Tables(0).Rows(nr - 1).Item(0)
xcod = "0" + Format(Val(xcod.Substring(1, 12)) + 1, "000000000000")
Else
xcod = "000000000000"
End If
TextBox1.Text = xcod
TextBox2.Focus()

End Sub

Private Sub btnguardar_Click(ByVal sender As Object, ByVal e As


System.EventArgs) Handles btnguardar.Click
'guardar registro
fila = ds1.Tables(0).NewRow
asigna()
ds1.Tables(0).Rows.Add(fila)
da1.Update(ds1.Tables("factura"))
nr = ds1.Tables(0).DefaultView.Count
selecciona(btnultimo)

End Sub

Private Sub btncancelar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btncancelar.Click
Dim x As Control
For Each x In Me.Controls
If TypeOf x Is TextBox Then x.Text = ""
Next

End Sub

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


Handles btneliminar.Click
If indice > 0 Then
dv1.Delete(indice)
da1.Update(ds1.Tables("factura"))
nr = ds1.Tables(0).DefaultView.Count()
selecciona(btnultimo)
End If

End Sub

Private Sub btnsalir_Click(sender As Object, e As EventArgs) Handles


btnsalir.Click
End

End Sub
Private Sub HandlesClick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnprimero.Click, btnanterior.Click,
btnsiguiente.Click, btnultimo.Click
selecciona(CType(sender, Button))
End Sub
End Class

Imports System.Data
Imports System.Data.SqlClient
Public Class Form2
Public cn As New SqlConnection
Public da1 As SqlDataAdapter
Public ds1 As New DataSet
Public dv1 As New DataView
Public objCM As SqlCommandBuilder
Public fila As DataRow
Dim indice As Integer
Dim totr As Integer
Dim nr As Integer
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'cn = New
SqlConnection("server=(local);uid=sa;password=123;database=polleria")
cn = New SqlConnection("Data Source=.;Initial Catalog=polleria;Integrated
Security=True")
cn.Open()
da1 = New SqlDataAdapter("SELECT
codemp,nom,dni,fnac,telf,dirección,email,turno,tipo From empleados", cn)
objCM = New SqlCommandBuilder(da1)
da1.Fill(ds1, "empleados")
dv1 = ds1.Tables("empleados").DefaultView
dv1.AllowNew = True
dv1.AllowEdit = True
dv1.AllowDelete = True
DataGridView1.DataSource = dv1
nr = ds1.Tables(0).DefaultView.Count
indice = 0
If nr > 0 Then
selecciona(btnprimero)
End If
End Sub
Sub selecciona(ByVal btn As Button)
'mostrar nro de registro
Dim totr As Integer = nr - 1
If btn Is btnprimero Then
indice = 0
ElseIf btn Is btnanterior Then
indice -= 1
If indice > totr Then indice = totr
ElseIf btn Is btnsiguiente Then
indice += 1
If indice < totr Then indice = 0
Else
indice = totr
End If
muestradatos(indice)
TextBox10.Text = (indice + 1).ToString & "/" & nr
End Sub

Sub muestradatos(ByVal nro As Integer)


'mostrar registro
fila = ds1.Tables("empleados").Rows(nro)
TextBox1.Text = fila.Item(0)
TextBox2.Text = fila.Item(1)
TextBox3.Text = fila.Item(2)
TextBox4.Text = fila.Item(3)
TextBox5.Text = fila.Item(4)
TextBox6.Text = fila.Item(5)
TextBox7.Text = fila.Item(6)
TextBox8.Text = fila.Item(7)
TextBox9.Text = fila.Item(8)
End Sub
Sub asigna()
'asignar items
fila.Item(0) = TextBox1.Text
fila.Item(1) = TextBox2.Text
fila.Item(2) = TextBox3.Text
fila.Item(3) = TextBox4.Text
fila.Item(4) = TextBox5.Text
fila.Item(5) = TextBox6.Text
fila.Item(6) = TextBox7.Text
fila.Item(7) = TextBox8.Text
fila.Item(8) = TextBox9.Text
End Sub

Private Sub btnnuevo_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnnuevo.Click
'agregar nuevo registro
Dim x As Control
Dim xcod As String
For Each x In Me.Controls
If TypeOf x Is TextBox Then x.Text = ""
Next
totr = ds1.Tables(0).DefaultView.Count
If totr > 0 Then
xcod = ds1.Tables(0).Rows(nr - 1).Item(0)
xcod = "E" + Format(Val(xcod.Substring(1, 3)) + 1, "000")
Else
xcod = "e001"
End If
TextBox1.Text = xcod
TextBox2.Focus()

End Sub

Private Sub btnguardar_Click(ByVal sender As Object, ByVal e As


System.EventArgs) Handles btnguardar.Click
'guardar registro
fila = ds1.Tables(0).NewRow
asigna()
ds1.Tables(0).Rows.Add(fila)
da1.Update(ds1.Tables("empleados"))
nr = ds1.Tables(0).DefaultView.Count
selecciona(btnultimo)

End Sub

Private Sub btncancelar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btncancelar.Click
Dim x As Control
For Each x In Me.Controls
If TypeOf x Is TextBox Then x.Text = ""
Next

End Sub

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


Handles btneliminar.Click
If indice > 0 Then
dv1.Delete(indice)
da1.Update(ds1.Tables("empleados"))
nr = ds1.Tables(0).DefaultView.Count()
selecciona(btnultimo)
End If

End Sub

Private Sub btnsalir_Click(sender As Object, e As EventArgs) Handles


btnsalir.Click
End
End Sub
Private Sub HandlesClick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnprimero.Click, btnanterior.Click,
btnsiguiente.Click, btnultimo.Click
selecciona(CType(sender, Button))
End Sub
End Class

Imports System.Data
Imports System.Data.SqlClient
Public Class Form1
Public cn As New SqlConnection
Public da1 As SqlDataAdapter
Public ds1 As New DataSet
Public dv1 As New DataView
Public objCM As SqlCommandBuilder
Public fila As DataRow
Dim indice As Integer
Dim totr As Integer
Dim nr As Integer

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


System.EventArgs) Handles MyBase.Load
'cn = New
SqlConnection("server=(local);uid=sa;password=123;database=polleria")
cn = New SqlConnection("Data Source=.;Initial Catalog=polleria;Integrated
Security=True")
cn.Open()
da1 = New SqlDataAdapter("SELECT codcli,nom,dni,fnac,telf,dirección,email
From cliente", cn)
objCM = New SqlCommandBuilder(da1)
da1.Fill(ds1, "cliente")
dv1 = ds1.Tables("cliente").DefaultView
dv1.AllowNew = True
dv1.AllowEdit = True
dv1.AllowDelete = True
DataGridView1.DataSource = dv1
nr = ds1.Tables(0).DefaultView.Count
indice = 0
If nr > 0 Then
selecciona(btnprimero)
End If
End Sub

Sub selecciona(ByVal btn As Button)


'mostrar nro de registro
Dim totr As Integer = nr - 1
If btn Is btnprimero Then
indice = 0
ElseIf btn Is btnanterior Then
indice -= 1
If indice > totr Then indice = totr
ElseIf btn Is btnsiguiente Then
indice += 1
If indice < totr Then indice = 0
Else
indice = totr
End If
muestradatos(indice)
TextBox8.Text = (indice + 1).ToString & "/" & nr
End Sub

Sub muestradatos(ByVal nro As Integer)


'mostrar registro
fila = ds1.Tables("cliente").Rows(nro)
TextBox1.Text = fila.Item(0)
TextBox2.Text = fila.Item(1)
TextBox3.Text = fila.Item(2)
TextBox4.Text = fila.Item(3)
TextBox5.Text = fila.Item(4)
TextBox6.Text = fila.Item(5)
TextBox7.Text = fila.Item(6)
End Sub
Sub asigna()
'asignar items
fila.Item(0) = TextBox1.Text
fila.Item(1) = TextBox2.Text
fila.Item(2) = TextBox3.Text
fila.Item(3) = TextBox4.Text
fila.Item(4) = TextBox5.Text
fila.Item(5) = TextBox6.Text
fila.Item(6) = TextBox7.Text
End Sub

Private Sub btnnuevo_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnnuevo.Click
'agregar nuevo registro
Dim x As Control
Dim xcod As String
For Each x In Me.Controls
If TypeOf x Is TextBox Then x.Text = ""
Next
totr = ds1.Tables(0).DefaultView.Count
If totr > 0 Then
xcod = ds1.Tables(0).Rows(nr - 1).Item(0)
xcod = "C" + Format(Val(xcod.Substring(1, 3)) + 1, "000")
Else
xcod = "c001"
End If
TextBox1.Text = xcod
TextBox2.Focus()
End Sub

Private Sub btnguardar_Click(ByVal sender As Object, ByVal e As


System.EventArgs) Handles btnguardar.Click
'guardar registro
fila = ds1.Tables(0).NewRow
asigna()
ds1.Tables(0).Rows.Add(fila)
da1.Update(ds1.Tables("cliente"))
nr = ds1.Tables(0).DefaultView.Count
selecciona(btnultimo)
End Sub

Private Sub btncancelar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btncancelar.Click
Dim x As Control
For Each x In Me.Controls
If TypeOf x Is TextBox Then x.Text = ""
Next
End Sub
Private Sub btneliminar_Click(ByVal sender As Object, e As System.EventArgs)
Handles btneliminar.Click
If indice > 0 Then
dv1.Delete(indice)
da1.Update(ds1.Tables("cliente"))
nr = ds1.Tables(0).DefaultView.Count()
selecciona(btnultimo)
End If
End Sub

Private Sub HandlesClick(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnprimero.Click, btnanterior.Click,
btnsiguiente.Click, btnultimo.Click
selecciona(CType(sender, Button))
End Sub

End Class

You might also like