Professional Documents
Culture Documents
16 de
nov.
Practica Nº23
080260173-2
5101- I
16 de Noviembre de 2010
1
Practica Nº23
16 de
nov.
Lista de Cotejo
INSTRUCCIONES DE APLICACIÓN.
Verifique que se encuentren los componentes señalados abajo y marque con una √ el registro
de cumplimiento correspondiente.
DESARROLLO
REGISTRO DE
REGISTRO DE
2
Practica Nº23
16 de
nov.
FORMULARIO
Botón Calcular
Private Sub cmdCalcular_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles cmdCalcular.Click
txtneto.Text = Int(txthoras.Text) * Int(txtpago.Text)
txtdescuento.Text = Int(txtneto.Text) / 10
txttotal.Text = Int(txtneto.Text) - Int(txtdescuento.Text)
If Int(txttotal.Text) < 1000 Then
msg = "Deja de vegetar"
Else
msg = "TU TU MUY BIEN"
End If
MsgBox(msg, MsgBoxStyle.Information, "MENSAJE")
End Sub
Botón Guardar
Private Sub cmdGuardar_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdGuardar.Click
cn.Open()
Dim GuardarDatos As String = "Insert into Salarios
(Horas,Pagoxhora,neto,Descuento,total,Mensaje)" & "Values('" &
txthoras.Text & "','" & txtpago.Text & "','" & txtneto.Text & "','" &
txtdescuento.Text & "','" & txttotal.Text & "','" & msg & "')"
Dim DataAdapter As New OleDb.OleDbDataAdapter(GuardarDatos,
cn)
DataAdapter.Fill(dt)
MsgBox("Se agrego el registro correctamente",
MsgBoxStyle.Information, "Mensaje")
DataAdapter.Dispose()
cn.Close()
End Sub
3
Practica Nº23
16 de
nov.
Botón Consultar
Private Sub cmdConsultar_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles cmdConsultar.Click
cn.Open()
Dim ConsultarDatos As String = "select * from Salarios where
horas = " & CInt(txthoras.Text)
Dim DataAdapter As New OleDb.OleDbDataAdapter(ConsultarDatos,
cn)
DataAdapter.Fill(dt)
fila = 0
txthoras.Text = CInt(dt.Rows(fila)("Horas"))
txtpago.Text = CInt(dt.Rows(fila)("Pagoxhora"))
txtneto.Text = CInt(dt.Rows(fila)("Neto"))
txtdescuento.Text = CInt(dt.Rows(fila)("Descuento"))
txttotal.Text = CInt(dt.Rows(fila)("Total"))
MsgBox("Se Encontro el registro correctamente",
MsgBoxStyle.Information, "Mensaje")
DataAdapter.Dispose()
cn.Close()
End Sub
Botón Modificar
Private Sub cmdModificar_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles cmdModificar.Click
cn.Open()
Dim ModificarDatos As String = "Update Salarios set Horas='" &
txthoras.Text & "', Pagoxhora='" & txtpago.Text & "' , Neto='" &
txtneto.Text & "' , Descuento='" & txtdescuento.Text & "' , Total='" &
txttotal.Text & "' , Mensaje='Modificado' where Horas = " &
CInt(txthoras.Text)
Dim dataAdapter As New OleDb.OleDbDataAdapter(ModificarDatos,
cn)
dataAdapter.Fill(dt)
txthoras.Text = CInt(dt.Rows(fila)("Horas"))
txtpago.Text = CInt(dt.Rows(fila)("Pagoxhora"))
txtneto.Text = CInt(dt.Rows(fila)("Neto"))
txtdescuento.Text = CInt(dt.Rows(fila)("Descuento"))
txttotal.Text = CInt(dt.Rows(fila)("Total"))
MsgBox("Registro Modificado Correctamente")
cn.Close()
End Sub
Botón Borrar
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim BorrarDatos As String = "Delete * from Salarios Where
Horas = " & CInt(txthoras.Text)
Dim dataAdapter As New OleDb.OleDbDataAdapter(BorrarDatos, cn)
dataAdapter.Fill(dt)
refrescar()
actualizar()
MsgBox("El registro a sido eliminado satisfactoriamente")
dataAdapter.Dispose()
cn.Close()
End Sub
4
Practica Nº23
16 de
nov.
Procedimientos
Public Sub refrescar()
dt.reset()
fila = 0
Dim refrescardatos As String = "select * from Salarios"
Dim Adapter As New OleDb.OleDbDataAdapter(refrescardatos, cn)
Adapter.Fill(dt)
End Sub
Public Sub actualizar()
txtHoras.Text = CInt(dt.Rows(fila)("Horas"))
txtpago.Text = CInt(dt.Rows(fila)("PagoxHora"))
txtneto.Text = CInt(dt.Rows(fila)("Neto"))
txtDescuento.Text = CInt(dt.Rows(fila)("Descuento"))
txtTotal.Text = CInt(dt.Rows(fila)("Total"))
End Sub
Resultado