home *** CD-ROM | disk | FTP | other *** search
/ An Introduction to Progr…l Basic 6.0 (4th Edition) / An Introduction to Programming using Visual Basic 6.0.iso / PROGRAMS / CH4 / 4-3-5.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-11-02  |  2.0 KB  |  69 lines

  1. VERSION 5.00
  2. Begin VB.Form frm4_3_5 
  3.    Caption         =   "Ceil Function"
  4.    ClientHeight    =   2850
  5.    ClientLeft      =   1965
  6.    ClientTop       =   1695
  7.    ClientWidth     =   2370
  8.    BeginProperty Font 
  9.       Name            =   "MS Sans Serif"
  10.       Size            =   8.25
  11.       Charset         =   0
  12.       Weight          =   700
  13.       Underline       =   0   'False
  14.       Italic          =   0   'False
  15.       Strikethrough   =   0   'False
  16.    EndProperty
  17.    LinkTopic       =   "Form1"
  18.    PaletteMode     =   1  'UseZOrder
  19.    ScaleHeight     =   2850
  20.    ScaleWidth      =   2370
  21.    Begin VB.PictureBox picResults 
  22.       Height          =   1215
  23.       Left            =   240
  24.       ScaleHeight     =   1155
  25.       ScaleWidth      =   1875
  26.       TabIndex        =   3
  27.       Top             =   1440
  28.       Width           =   1935
  29.    End
  30.    Begin VB.CommandButton cmdCalculate 
  31.       Caption         =   "Calculate Ceil"
  32.       Default         =   -1  'True
  33.       Height          =   495
  34.       Left            =   240
  35.       TabIndex        =   2
  36.       Top             =   720
  37.       Width           =   1935
  38.    End
  39.    Begin VB.TextBox txtNumber 
  40.       Height          =   285
  41.       Left            =   1200
  42.       TabIndex        =   1
  43.       Top             =   240
  44.       Width           =   975
  45.    End
  46.    Begin VB.Label lblNumber 
  47.       Caption         =   "Enter a number"
  48.       Height          =   375
  49.       Left            =   240
  50.       TabIndex        =   0
  51.       Top             =   120
  52.       Width           =   735
  53.    End
  54. Attribute VB_Name = "frm4_3_5"
  55. Attribute VB_GlobalNameSpace = False
  56. Attribute VB_Creatable = False
  57. Attribute VB_PredeclaredId = True
  58. Attribute VB_Exposed = False
  59. Private Function Ceil(x As Single) As Single
  60.   'Round nonintegers up
  61.   Ceil = -Int(-x)
  62. End Function
  63. Private Sub cmdCalculate_Click()
  64.   'Demonstrate the Ceil function
  65.   picResults.Print "Ceil("; txtNumber.Text; ") ="; Ceil(Val(txtNumber.Text))
  66.   txtNumber.Text = ""
  67.   txtNumber.SetFocus
  68. End Sub
  69.