You are on page 1of 1

Visual Basic [Tutorial] - Pebulatan Mata Uang - (String Handling)

(Sunday, 23 March 1997) - Contributed by Rizki Noor Hidayat Wijaya - Last Updated (Sunday, 23 March 1997)

Visual Basic [Tutorial] - Pebulatan Mata Uang - (Registry) code#c {color: green;} /* used for comments */ code#k {color: blue;} /* used for keywords */ hr {color: black; height: 100%;} /* used for separating procedures */

Dim TotCost As Single Dim srTotal As String Dim Quarters As Integer

Visual Basic [Tutorial] - Pebulatan Mata Uang - (Registry) code#c {color: green;} /* used for comments */ code#k {color: blue;} /* used for keywords */ hr {color: black; height: 100%;} /* used for separating procedures */

Private Sub cmdRound_Click() TotCost = Val(txtCost.Text) srTotal = CCur(TotCost) srTotal = Format(srTotal, "currency") If Val(Right$(srTotal, 2)) > 75 Then srTotal = Int(srTotal) + 1 ElseIf Val(Right$(srTotal, 2)) > 50 Then Quarters = 3 srTotal = Int(srTotal) + (0.25 * Quarters) ElseIf Val(Right$(srTotal, 2)) > 25 Then Quarters = 2 srTotal = Int(srTotal) + (0.25 * Quarters) ElseIf Val(Right(srTotal, 2)) > 0 Then Quarters = 1 srTotal = Int(srTotal) + (0.25 * Quarters) End If srTotal = Format(srTotal, "currency") lblRounded.Caption = srTotal End Sub

http://www.riskydigital.com - www.riskydigital.com

Powered by Mambo

Generated: 12 July, 2011, 17:02

You might also like