How to create money
denominator
1st Step: Create Design.
Ø Drag a 1 label onto the form and
change the label TEXT in properties.
o
Change
the TEXT into “Input Value :”
Ø Drag a 2 textbox onto the form and change the
textbox NAME in properties.
o
For
1st textbox change the NAME into “txtInputValue”
o
For
2nd
textbox change the NAME into “txtResult”
Ø Drag a 1 Button onto the form and
change the Button NAME and TEXT in properties.
o
For
Button name change the NAME into “btnDenominate”.
o
For
Button text change the TEXT into “Denominate”.
2nd Step: Start Coding.
Ø To Start Coding, double click the
Form.
o
Code
for the Form
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
txtResult.Text = " 1000 : " & n1000 & vbNewLine
& "
500 : " & n500 & vbNewLine & " 200 :
" & n200 & vbNewLine & " 100 : " & n100 & vbNewLine & " 50 : " & n50 &
vbNewLine & " 20 : " & n20 & vbNewLine & " 10 : " & n10 &
vbNewLine & " 5 : " & n5 & vbNewLine & " 1 : " & n1
End Sub
Ø Go back to design, then double click
the Denominate Button
o
Code for the Denominate Button
Private Sub btnDenominate_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnDenominate.Click
n1000 = txtInputValue.Text \ 1000
n500 = (txtInputValue.Text Mod 1000) \ 500
n200 = ((txtInputValue.Text Mod 1000) Mod 500) \
200
n100 = (((txtInputValue.Text Mod 1000) Mod 500) Mod 200) \ 100
n50 = ((((txtInputValue.Text Mod 1000) Mod 500) Mod 200) Mod 100) \
50
n20 = (((((txtInputValue.Text Mod 1000) Mod 500) Mod 200) Mod 100) Mod 50) \ 20
n10 = ((((((txtInputValue.Text Mod 1000) Mod 500) Mod 200) Mod 100) Mod 50) Mod 20) \ 10
n5 = (((((((txtInputValue.Text Mod 1000)
Mod 500) Mod
200) Mod 100) Mod
50) Mod 20) Mod
10) \ 5
n1 = ((((((((txtInputValue.Text Mod 1000) Mod 500) Mod 200) Mod 100) Mod 50) Mod 20) Mod 10) Mod 5) \ 1
txtResult.Text = " 1000 : " & n1000 & vbNewLine
& "
500 : " & n500 & vbNewLine & " 200 :
" & n200 & vbNewLine &" 100 : " & n100 &
vbNewLine & " 50 : " & n50 & vbNewLine & " 20 : " & n20 &
vbNewLine & " 10 : " & n10 &
vbNewLine & " 5 : " & n5 & vbNewLine & "1
: " & n1
End Sub
3rd Step: Run the Program.
Ø Click to start Debugging Button (F5).
Code:
Public Class Form1
Dim n1000,
n500, n200, n100, n50, n20, n10, n5, n1 As String
Private Sub btnDenominate_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnDenominate.Click
n1000 = txtInputValue.Text \ 1000
n500 = (txtInputValue.Text Mod 1000) \ 500
n200 = ((txtInputValue.Text Mod 1000) Mod 500) \
200
n100 = (((txtInputValue.Text Mod 1000) Mod 500) Mod 200) \ 100
n50 = ((((txtInputValue.Text Mod 1000) Mod 500) Mod 200) Mod 100) \
50
n20 = (((((txtInputValue.Text Mod 1000) Mod 500) Mod 200) Mod 100) Mod 50) \ 20
n10 = ((((((txtInputValue.Text Mod 1000) Mod 500) Mod 200) Mod 100) Mod 50) Mod 20) \ 10
n5 = (((((((txtInputValue.Text Mod 1000) Mod 500) Mod 200) Mod 100) Mod 50) Mod 20) Mod 10) \ 5
n1 = ((((((((txtInputValue.Text Mod 1000) Mod 500) Mod 200) Mod 100) Mod 50) Mod 20) Mod 10) Mod 5) \ 1
txtResult.Text = " 1000 : " & n1000 & vbNewLine
& "
500 : " & n500 & vbNewLine & " 200 :
" & n200 & vbNewLine & " 100 : " & n100 &
vbNewLine & " 50 : " & n50 &
vbNewLine & " 20 : " & n20 &
vbNewLine & " 10 : " & n10 &
vbNewLine & " 5 : " & n5 &
vbNewLine & " 1 : " & n1
End Sub
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
txtResult.Text = " 1000 : " & n1000 & vbNewLine
& "
500 : " & n500 & vbNewLine & " 200 :
" & n200 & vbNewLine & " 100 : " & n100 &
vbNewLine & " 50 : " & n50 &
vbNewLine & " 20 : " & n20 &
vbNewLine & " 10 : " & n10 &
vbNewLine & " 5 : " & n5 &
vbNewLine & " 1 : " & n1
End Sub
End Class
The info is good enough.I preview this type of good article only. Good job
ReplyDeleteDOT NET Training in Chennai
DOT NET Course in Chennai
Dot Net Training in T Nagar
Html5 Training in Chennai
Html5 Training
QTP Training in Chennai
SAS Training in Chennai
DOT NET Training in Chennai