You are on page 1of 5

Rubrica Nº3

Programación Con Sistemas Gestores De


Bases De Datos

Ing. Sergio González Pérez

Santiago Antonio Gaytan Piña

080260173-2

5101- I

28 de Octubre de 2010
FORMULARIO

Botón Calcular
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles cmdcalcular.Click
can = txtcan.Text
If (can <= 999999 And can >= 0) Then
If can >= 500 Then
b500 = can \ 500
can = can Mod 500
End If
If can >= 200 Then
b200 = can \ 200
can = can Mod 200
End If
If can >= 100 Then
b100 = can \ 100
can = can Mod 100
End If
If can >= 50 Then
b50 = can \ 50
can = can Mod 50
End If
If can >= 20 Then
b20 = can \ 20
can = can Mod 20
End If
txt500.Text = b500
txt200.Text = b200
txt100.Text = b100
txt50.Text = b50
txt20.Text = b20
MsgBox(Num2Text(CDbl(txtcan.Text)))
Else
MsgBox("Debe ser una cantidad entre 20 y 1,000,000 Pesos")
End If
End Sub
Public Function Num2Text(ByVal value As Double) As String
Select Case value
Case 0 : Num2Text = "CERO"
Case 1 : Num2Text = "UN0"
Case 2 : Num2Text = "DOS"
Case 3 : Num2Text = "TRES"
Case 4 : Num2Text = "CUATRO"
Case 5 : Num2Text = "CINCO"
Case 6 : Num2Text = "SEIS"
Case 7 : Num2Text = "SIETE"
Case 8 : Num2Text = "OCHO"
Case 9 : Num2Text = "NUEVE"
Case 10 : Num2Text = "DIEZ"
Case 11 : Num2Text = "ONCE"
Case 12 : Num2Text = "DOCE"
Case 13 : Num2Text = "TRECE"
Case 14 : Num2Text = "CATORCE"
Case 15 : Num2Text = "QUINCE"
Case Is < 20 : Num2Text = "DIECI" & Num2Text(value - 10)
Case 20 : Num2Text = "VEINTE"
Case Is < 30 : Num2Text = "VEINTI" & Num2Text(value - 20)
Case 30 : Num2Text = "TREINTA"
Case 40 : Num2Text = "CUARENTA"
Case 50 : Num2Text = "CINCUENTA"
Case 60 : Num2Text = "SESENTA"
Case 70 : Num2Text = "SETENTA"
Case 80 : Num2Text = "OCHENTA"
Case 90 : Num2Text = "NOVENTA"
Case Is < 100 : Num2Text = Num2Text(Int(value \ 10) * 10)
& " Y " & Num2Text(value Mod 10)
Case 100 : Num2Text = "CIEN"
Case Is < 200 : Num2Text = "CIENTO " & Num2Text(value -
100)
Case 200, 300, 400, 600, 800 : Num2Text =
Num2Text(Int(value \ 100)) & "CIENTOS"
Case 500 : Num2Text = "QUINIENTOS"
Case 700 : Num2Text = "SETECIENTOS"
Case 900 : Num2Text = "NOVECIENTOS"
Case Is < 1000 : Num2Text = Num2Text(Int(value \ 100) *
100) & " " & Num2Text(value Mod 100)
Case 1000 : Num2Text = "MIL"
Case Is < 2000 : Num2Text = "MIL " & Num2Text(value Mod
1000)
Case Is < 1000000 : Num2Text = Num2Text(Int(value \ 1000))
& " MIL"
If value Mod 1000 Then Num2Text = Num2Text & " " &
Num2Text(value Mod 1000)
Case 1000000 : Num2Text = "UN MILLON"
Case Else : Num2Text = "No hay dinero suficiente"
End Select
End Function
Botón Agregar
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
cn.Open()
Dim GuardarDatos As String = "Insert into Billetes
(Cantidad,B500,B200,B100,B50,B20,Numatext)" & "Values('" & txtcan.Text
& "' , '" & txt500.Text & "','" & txt200.Text & "' , '" & txt100.Text
& "', '" & txt50.Text & "', '" & txt20.Text & "', '" &
Num2Text(CDbl(txtcan.Text)) & "')"
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

Botón Limpiar
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
txtcan.Text = ""
txt500.Text = ""
txt200.Text = ""
txt100.Text = ""
txt50.Text = ""
txt20.Text = ""
End Sub
Resultados

You might also like