VERSION 5.00 Begin VB.Form frmNumberBreakdown Caption = "Number Breakdown" ClientHeight = 2556 ClientLeft = 48 ClientTop = 276 ClientWidth = 4092 LinkTopic = "Form1" ScaleHeight = 2556 ScaleWidth = 4092 StartUpPosition = 3 'Windows Default Begin VB.CommandButton cmdDone Caption = "Done" Height = 372 Left = 2520 TabIndex = 4 Top = 2040 Width = 1332 End Begin VB.CommandButton cmdBreakDown Caption = "Break Down" Height = 372 Left = 2520 TabIndex = 3 Top = 1560 Width = 1332 End Begin VB.TextBox txtNumber Height = 288 Left = 1560 TabIndex = 1 Top = 360 Width = 732 End Begin VB.Label lblNumberBreakdown Height = 612 Left = 240 TabIndex = 2 Top = 960 Width = 2892 End Begin VB.Label lblEnterNumber Caption = "Enter number:" Height = 252 Left = 240 TabIndex = 0 Top = 360 Width = 1212 End End Attribute VB_Name = "frmNumberBreakdown" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Private Sub txtNumber_Change() lblNumberBreakdown.Caption = "" End Sub Private Sub cmdBreakDown_Click() Dim intNumberEntered As Integer Dim intTensDigit As Integer, intOnesDigit As Integer intNumberEntered = txtNumber.Text If intNumberEntered < 10 Then lblNumberBreakdown.Caption = "The first digit is: " & intNumberEntered ElseIf intNumberEntered < 100 Then Call TwoDigits(intNumberEntered, intTensDigit, intOnesDigit) lblNumberBreakdown.Caption = "The first digit is: " & intTensDigit & _ vbCrLf & "The second digit is: " & intOnesDigit Else lblNumberBreakdown.Caption = "Enter a number less than 100." End If End Sub '***************************************************************** ' The first digit of intNum is returned as intFirstDigit. The ' second digit of intNum is returned as intSecondDigit. ' ' pre: intNum is a number less than 100. ' post: intFirstDigit is a number between 0 and 9 inclusive. ' intSecondDigit is a number between 0 and 9 inclusive. '***************************************************************** Sub TwoDigits(ByVal intNum As Integer, ByRef intFirstDigit As Integer, _ ByRef intSecondDigit As Integer) intFirstDigit = intNum \ 10 intSecondDigit = intNum Mod 10 End Sub Private Sub cmdDone_Click() Unload Me End Sub