home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / verysi1a / calc.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-06-02  |  15.8 KB  |  528 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Calcu"
  4.    ClientHeight    =   3285
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   2175
  8.    Icon            =   "calc.frx":0000
  9.    LinkTopic       =   "Form1"
  10.    Picture         =   "calc.frx":08CA
  11.    ScaleHeight     =   3285
  12.    ScaleWidth      =   2175
  13.    StartUpPosition =   3  'Windows Default
  14.    Begin VB.CommandButton Command4 
  15.       BackColor       =   &H000000C0&
  16.       Caption         =   "C"
  17.       BeginProperty Font 
  18.          Name            =   "MS Sans Serif"
  19.          Size            =   8.25
  20.          Charset         =   0
  21.          Weight          =   700
  22.          Underline       =   0   'False
  23.          Italic          =   0   'False
  24.          Strikethrough   =   0   'False
  25.       EndProperty
  26.       Height          =   255
  27.       Left            =   1680
  28.       Style           =   1  'Graphical
  29.       TabIndex        =   20
  30.       Top             =   2520
  31.       Width           =   375
  32.    End
  33.    Begin VB.CommandButton Command3 
  34.       BackColor       =   &H000000FF&
  35.       Caption         =   "Off"
  36.       BeginProperty Font 
  37.          Name            =   "MS Sans Serif"
  38.          Size            =   8.25
  39.          Charset         =   0
  40.          Weight          =   700
  41.          Underline       =   0   'False
  42.          Italic          =   0   'False
  43.          Strikethrough   =   0   'False
  44.       EndProperty
  45.       Height          =   255
  46.       Left            =   1080
  47.       Style           =   1  'Graphical
  48.       TabIndex        =   19
  49.       Top             =   2520
  50.       Width           =   375
  51.    End
  52.    Begin VB.TextBox Text2 
  53.       BackColor       =   &H000000C0&
  54.       BeginProperty Font 
  55.          Name            =   "MS Sans Serif"
  56.          Size            =   8.25
  57.          Charset         =   0
  58.          Weight          =   700
  59.          Underline       =   0   'False
  60.          Italic          =   0   'False
  61.          Strikethrough   =   0   'False
  62.       EndProperty
  63.       Height          =   285
  64.       Left            =   720
  65.       TabIndex        =   17
  66.       Top             =   2880
  67.       Width           =   1335
  68.    End
  69.    Begin VB.CommandButton Command16 
  70.       BackColor       =   &H000000C0&
  71.       Caption         =   "X"
  72.       BeginProperty Font 
  73.          Name            =   "MS Sans Serif"
  74.          Size            =   9.75
  75.          Charset         =   0
  76.          Weight          =   700
  77.          Underline       =   0   'False
  78.          Italic          =   0   'False
  79.          Strikethrough   =   0   'False
  80.       EndProperty
  81.       Height          =   375
  82.       Left            =   1680
  83.       Style           =   1  'Graphical
  84.       TabIndex        =   16
  85.       Top             =   600
  86.       Width           =   375
  87.    End
  88.    Begin VB.CommandButton Command15 
  89.       BackColor       =   &H000000C0&
  90.       Caption         =   "
  91.       BeginProperty Font 
  92.          Name            =   "MS Sans Serif"
  93.          Size            =   13.5
  94.          Charset         =   0
  95.          Weight          =   700
  96.          Underline       =   0   'False
  97.          Italic          =   0   'False
  98.          Strikethrough   =   0   'False
  99.       EndProperty
  100.       Height          =   375
  101.       Left            =   1680
  102.       Style           =   1  'Graphical
  103.       TabIndex        =   15
  104.       Top             =   1080
  105.       Width           =   375
  106.    End
  107.    Begin VB.CommandButton Command14 
  108.       BackColor       =   &H000000C0&
  109.       Caption         =   "+"
  110.       BeginProperty Font 
  111.          Name            =   "MS Sans Serif"
  112.          Size            =   12
  113.          Charset         =   0
  114.          Weight          =   700
  115.          Underline       =   0   'False
  116.          Italic          =   0   'False
  117.          Strikethrough   =   0   'False
  118.       EndProperty
  119.       Height          =   375
  120.       Left            =   1680
  121.       Style           =   1  'Graphical
  122.       TabIndex        =   14
  123.       Top             =   1560
  124.       Width           =   375
  125.    End
  126.    Begin VB.CommandButton Command13 
  127.       BackColor       =   &H000000C0&
  128.       Caption         =   "-"
  129.       BeginProperty Font 
  130.          Name            =   "MS Sans Serif"
  131.          Size            =   13.5
  132.          Charset         =   0
  133.          Weight          =   700
  134.          Underline       =   0   'False
  135.          Italic          =   0   'False
  136.          Strikethrough   =   0   'False
  137.       EndProperty
  138.       Height          =   375
  139.       Left            =   1680
  140.       Style           =   1  'Graphical
  141.       TabIndex        =   13
  142.       Top             =   2040
  143.       Width           =   375
  144.    End
  145.    Begin VB.CommandButton Command12 
  146.       BackColor       =   &H000000FF&
  147.       Caption         =   "="
  148.       BeginProperty Font 
  149.          Name            =   "MS Sans Serif"
  150.          Size            =   9.75
  151.          Charset         =   0
  152.          Weight          =   700
  153.          Underline       =   0   'False
  154.          Italic          =   0   'False
  155.          Strikethrough   =   0   'False
  156.       EndProperty
  157.       Height          =   375
  158.       Left            =   1080
  159.       Style           =   1  'Graphical
  160.       TabIndex        =   12
  161.       Top             =   2040
  162.       Width           =   375
  163.    End
  164.    Begin VB.CommandButton Command11 
  165.       BackColor       =   &H000000FF&
  166.       Caption         =   "0"
  167.       BeginProperty Font 
  168.          Name            =   "MS Sans Serif"
  169.          Size            =   9.75
  170.          Charset         =   0
  171.          Weight          =   700
  172.          Underline       =   0   'False
  173.          Italic          =   0   'False
  174.          Strikethrough   =   0   'False
  175.       EndProperty
  176.       Height          =   375
  177.       Left            =   600
  178.       Style           =   1  'Graphical
  179.       TabIndex        =   11
  180.       Top             =   2040
  181.       Width           =   375
  182.    End
  183.    Begin VB.CommandButton Command100 
  184.       BackColor       =   &H000000FF&
  185.       Caption         =   "."
  186.       BeginProperty Font 
  187.          Name            =   "MS Sans Serif"
  188.          Size            =   18
  189.          Charset         =   0
  190.          Weight          =   700
  191.          Underline       =   0   'False
  192.          Italic          =   0   'False
  193.          Strikethrough   =   0   'False
  194.       EndProperty
  195.       Height          =   375
  196.       Index           =   9
  197.       Left            =   120
  198.       Style           =   1  'Graphical
  199.       TabIndex        =   10
  200.       Top             =   2040
  201.       Width           =   375
  202.    End
  203.    Begin VB.CommandButton Command1 
  204.       BackColor       =   &H000000FF&
  205.       Caption         =   "9"
  206.       BeginProperty Font 
  207.          Name            =   "MS Sans Serif"
  208.          Size            =   9.75
  209.          Charset         =   0
  210.          Weight          =   700
  211.          Underline       =   0   'False
  212.          Italic          =   0   'False
  213.          Strikethrough   =   0   'False
  214.       EndProperty
  215.       Height          =   375
  216.       Index           =   8
  217.       Left            =   1080
  218.       Style           =   1  'Graphical
  219.       TabIndex        =   9
  220.       Top             =   1560
  221.       Width           =   375
  222.    End
  223.    Begin VB.CommandButton Command1 
  224.       BackColor       =   &H000000FF&
  225.       Caption         =   "8"
  226.       BeginProperty Font 
  227.          Name            =   "MS Sans Serif"
  228.          Size            =   9.75
  229.          Charset         =   0
  230.          Weight          =   700
  231.          Underline       =   0   'False
  232.          Italic          =   0   'False
  233.          Strikethrough   =   0   'False
  234.       EndProperty
  235.       Height          =   375
  236.       Index           =   7
  237.       Left            =   600
  238.       Style           =   1  'Graphical
  239.       TabIndex        =   8
  240.       Top             =   1560
  241.       Width           =   375
  242.    End
  243.    Begin VB.CommandButton Command1 
  244.       BackColor       =   &H000000FF&
  245.       Caption         =   "7"
  246.       BeginProperty Font 
  247.          Name            =   "MS Sans Serif"
  248.          Size            =   9.75
  249.          Charset         =   0
  250.          Weight          =   700
  251.          Underline       =   0   'False
  252.          Italic          =   0   'False
  253.          Strikethrough   =   0   'False
  254.       EndProperty
  255.       Height          =   375
  256.       Index           =   6
  257.       Left            =   120
  258.       Style           =   1  'Graphical
  259.       TabIndex        =   7
  260.       Top             =   1560
  261.       Width           =   375
  262.    End
  263.    Begin VB.CommandButton Command1 
  264.       BackColor       =   &H000000FF&
  265.       Caption         =   "6"
  266.       BeginProperty Font 
  267.          Name            =   "MS Sans Serif"
  268.          Size            =   9.75
  269.          Charset         =   0
  270.          Weight          =   700
  271.          Underline       =   0   'False
  272.          Italic          =   0   'False
  273.          Strikethrough   =   0   'False
  274.       EndProperty
  275.       Height          =   375
  276.       Index           =   5
  277.       Left            =   1080
  278.       Style           =   1  'Graphical
  279.       TabIndex        =   6
  280.       Top             =   1080
  281.       Width           =   375
  282.    End
  283.    Begin VB.CommandButton Command1 
  284.       BackColor       =   &H000000FF&
  285.       Caption         =   "5"
  286.       BeginProperty Font 
  287.          Name            =   "MS Sans Serif"
  288.          Size            =   9.75
  289.          Charset         =   0
  290.          Weight          =   700
  291.          Underline       =   0   'False
  292.          Italic          =   0   'False
  293.          Strikethrough   =   0   'False
  294.       EndProperty
  295.       Height          =   375
  296.       Index           =   4
  297.       Left            =   600
  298.       Style           =   1  'Graphical
  299.       TabIndex        =   5
  300.       Top             =   1080
  301.       Width           =   375
  302.    End
  303.    Begin VB.CommandButton Command1 
  304.       BackColor       =   &H000000FF&
  305.       Caption         =   "4"
  306.       BeginProperty Font 
  307.          Name            =   "MS Sans Serif"
  308.          Size            =   9.75
  309.          Charset         =   0
  310.          Weight          =   700
  311.          Underline       =   0   'False
  312.          Italic          =   0   'False
  313.          Strikethrough   =   0   'False
  314.       EndProperty
  315.       Height          =   375
  316.       Index           =   3
  317.       Left            =   120
  318.       Style           =   1  'Graphical
  319.       TabIndex        =   4
  320.       Top             =   1080
  321.       Width           =   375
  322.    End
  323.    Begin VB.CommandButton Command1 
  324.       BackColor       =   &H000000FF&
  325.       Caption         =   "3"
  326.       BeginProperty Font 
  327.          Name            =   "MS Sans Serif"
  328.          Size            =   9.75
  329.          Charset         =   0
  330.          Weight          =   700
  331.          Underline       =   0   'False
  332.          Italic          =   0   'False
  333.          Strikethrough   =   0   'False
  334.       EndProperty
  335.       Height          =   375
  336.       Index           =   2
  337.       Left            =   1080
  338.       Style           =   1  'Graphical
  339.       TabIndex        =   3
  340.       Top             =   600
  341.       Width           =   375
  342.    End
  343.    Begin VB.CommandButton Command1 
  344.       BackColor       =   &H000000FF&
  345.       Caption         =   "2"
  346.       BeginProperty Font 
  347.          Name            =   "MS Sans Serif"
  348.          Size            =   9.75
  349.          Charset         =   0
  350.          Weight          =   700
  351.          Underline       =   0   'False
  352.          Italic          =   0   'False
  353.          Strikethrough   =   0   'False
  354.       EndProperty
  355.       Height          =   375
  356.       Index           =   1
  357.       Left            =   600
  358.       Style           =   1  'Graphical
  359.       TabIndex        =   2
  360.       Top             =   600
  361.       Width           =   375
  362.    End
  363.    Begin VB.CommandButton Command1 
  364.       BackColor       =   &H000000FF&
  365.       Caption         =   "1"
  366.       BeginProperty Font 
  367.          Name            =   "MS Sans Serif"
  368.          Size            =   9.75
  369.          Charset         =   0
  370.          Weight          =   700
  371.          Underline       =   0   'False
  372.          Italic          =   0   'False
  373.          Strikethrough   =   0   'False
  374.       EndProperty
  375.       Height          =   375
  376.       Index           =   0
  377.       Left            =   120
  378.       Style           =   1  'Graphical
  379.       TabIndex        =   1
  380.       Top             =   600
  381.       Width           =   375
  382.    End
  383.    Begin VB.TextBox Text1 
  384.       BackColor       =   &H000000C0&
  385.       BeginProperty Font 
  386.          Name            =   "MS Sans Serif"
  387.          Size            =   8.25
  388.          Charset         =   0
  389.          Weight          =   700
  390.          Underline       =   0   'False
  391.          Italic          =   0   'False
  392.          Strikethrough   =   0   'False
  393.       EndProperty
  394.       Height          =   285
  395.       IMEMode         =   3  'DISABLE
  396.       Left            =   120
  397.       TabIndex        =   0
  398.       Top             =   120
  399.       Width           =   1935
  400.    End
  401.    Begin VB.Label Label2 
  402.       Caption         =   "0"
  403.       Height          =   255
  404.       Left            =   120
  405.       TabIndex        =   21
  406.       Top             =   3600
  407.       Width           =   255
  408.    End
  409.    Begin VB.Line Line2 
  410.       X1              =   240
  411.       X2              =   240
  412.       Y1              =   2400
  413.       Y2              =   2640
  414.    End
  415.    Begin VB.Line Line1 
  416.       X1              =   1080
  417.       X2              =   240
  418.       Y1              =   2640
  419.       Y2              =   2640
  420.    End
  421.    Begin VB.Label Label1 
  422.       BackStyle       =   0  'Transparent
  423.       Caption         =   "&Answer:"
  424.       Height          =   375
  425.       Left            =   120
  426.       TabIndex        =   18
  427.       Top             =   2890
  428.       Width           =   615
  429.    End
  430. Attribute VB_Name = "Form1"
  431. Attribute VB_GlobalNameSpace = False
  432. Attribute VB_Creatable = False
  433. Attribute VB_PredeclaredId = True
  434. Attribute VB_Exposed = False
  435. '111 Lines of  Code
  436. Private Sub Command1_Click(Index As Integer)
  437. Text1.Text = Text1.Text + Command1(Index).Caption
  438. End Sub
  439. Private Sub Command100_Click(Index As Integer)
  440. If InStr(Text1.Text, ".") Then
  441.     Exit Sub
  442.     Text1.Text = Text1.Text + "."
  443. End If
  444. End Sub
  445. Private Sub Command12_Click()
  446. On Error GoTo errhandler
  447. If Label2.Caption = "1" Then
  448. Text2.Text = Text2.Text * Text1.Text
  449. Text1.Text = ""
  450. End If
  451. If Label2.Caption = "2" Then
  452. Text2.Text = Text2.Text / Text1.Text
  453. Text1.Text = ""
  454. End If
  455. If Label2.Caption = "3" Then
  456. Text2.Text = Text2.Text + Text1.Text
  457. Text1.Text = ""
  458. End If
  459. If Label2.Caption = "4" Then
  460. Text2.Text = Text2.Text - Text1.Text
  461. Text1.Text = ""
  462. End If
  463. errhandler:
  464. End Sub
  465. Private Sub Command13_Click()
  466. Label2.Caption = "4"
  467. On Error GoTo errhandler
  468. If Text2.Text = "" Then
  469. Text2.Text = Text1.Text
  470. Text1.Text = ""
  471. End If
  472. If Text2.Text > "0" Then
  473. Text1.Text = Text2.Text - Text1.Text
  474. Text2.Text = Text1.Text
  475. Text1.Text = ""
  476. End If
  477. errhandler:
  478. End Sub
  479. Private Sub Command14_Click()
  480. Label2.Caption = "3"
  481. On Error GoTo errhandler
  482. If Text2.Text = "" Then
  483. Text2.Text = Text1.Text
  484. Text1.Text = ""
  485. End If
  486. If Text2.Text > "0" Then
  487. Text1.Text = Text2.Text + Text1.Text
  488. Text2.Text = Text1.Text
  489. Text1.Text = ""
  490. End If
  491. errhandler:
  492. End Sub
  493. Private Sub Command15_Click()
  494. Label2.Caption = "2"
  495. On Error GoTo errhandler
  496. If Text2.Text = "" Then
  497. Text2.Text = Text1.Text
  498. Text1.Text = ""
  499. End If
  500. If Text2.Text > "0" Then
  501. Text1.Text = Text2.Text / Text1.Text
  502. Text2.Text = Text1.Text
  503. Text1.Text = ""
  504. End If
  505. errhandler:
  506. End Sub
  507. Private Sub Command16_Click()
  508. Label2.Caption = "1"
  509. On Error GoTo errhandler
  510. If Text2.Text = "" Then
  511. Text2.Text = Text1.Text
  512. Text1.Text = ""
  513. End If
  514. If Text2.Text > "0" Then
  515. Text1.Text = Text2.Text * Text1.Text
  516. Text2.Text = Text1.Text
  517. Text1.Text = ""
  518. End If
  519. errhandler:
  520. End Sub
  521. Private Sub Command3_Click()
  522. End Sub
  523. Private Sub Command4_Click()
  524. Label2.Caption = "0"
  525. Text1.Text = ""
  526. Text2.Text = ""
  527. End Sub
  528.