Вы находитесь на странице: 1из 2

RUBRICA 3

Imports System.Data.OleDb
Public Class Form1
Dim dt As New DataTable
Dim cn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Vasquez\Cajero1.mdb")

BOTON CALCULAR
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim Cantidad As Integer = Int(txtCantidad.Text)
If Cantidad < 20 Then
MsgBox("Error..la cantidad debe ser mayor que $20")
ElseIf Cantidad > 5000 Then
MsgBox("Solo puedes retirar una cantidad menor de $5000")
Else
txt500.Text = Int(Cantidad / 500)
Cantidad = Cantidad Mod 500
txt200.Text = Int(Cantidad / 200)
Cantidad = Cantidad Mod 200
txt100.Text = Int(Cantidad / 100)
Cantidad = Cantidad Mod 100
txt50.Text = Int(Cantidad / 50)
Cantidad = Cantidad Mod 50
txt20.Text = Int(Cantidad / 20)
Cantidad = Cantidad Mod 20
End If

End Sub
BOTON LIMPIAR

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


System.EventArgs) Handles Button3.Click
txtCantidad.Text = ""
txt500.Text = ""
txt200.Text = ""
txt100.Text = ""
txt50.Text = ""
txt20.Text = ""
End Sub

MONICA VASQUEZ JIMENEZ 5101-I


BOTON AGREGAR

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


System.EventArgs) Handles Button2.Click
cn.Open()
Dim GuardarDatos As String = "Insert into Cajero (Cantidad, B500,
B200,B100,B50,B20)" & "Values('" & txtCantidad.Text & "', '" & txt500.Text & "','" &
txt200.Text & "','" & txt100.Text & "','" & txt50.Text & "','" & txt20.Text & "')"
Dim dataAdapter As New OleDb.OleDbDataAdapter(GuardarDatos, cn)
dataAdapter.Fill(dt)
MsgBox("se agrego registro correctamente", MsgBoxStyle.Information, "Mensaje")
dataAdapter.Dispose()

End Sub
End Class

MONICA VASQUEZ JIMENEZ 5101-I

Вам также может понравиться