Current area: HOME ->

Zip File view

Binary Patterns 1.0


This page allows you to view the contents of a file contained inside a ZIP archive available at Programmer's Heaven. This means you can view the code and find what you need from it without having to download the ZIP file first. If the file contains source code for a language we recognize, we have syntax highlighted it.

Filename displayed: Bin\frmBin.frm
Found in file: 23540.zip

Download: ManuSoft MkErr Error device for Turbo Pascal 6.0 MkErr let you build an error handler to pascal programs. Your  handler is called automatically on error. You can choose in  errorhandler what to do then, halt/print message/continue etc..
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form frmBin
   Caption         =   "Binary Operations"
   ClientHeight    =   3180
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7305
   LinkTopic       =   "Form1"
   ScaleHeight     =   3180
   ScaleWidth      =   7305
   StartUpPosition =   3  'Windows Default
   Begin MSComctlLib.StatusBar stbStatus
      Align           =   2  'Align Bottom
      Height          =   375
      Left            =   0
      TabIndex        =   13
      Top             =   2805
      Width           =   7305
      _ExtentX        =   12885
      _ExtentY        =   661
      Style           =   1
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
         NumPanels       =   1
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
         EndProperty
      EndProperty
   End
   Begin VB.CommandButton cmdClose
      Caption         =   "&Close"
      Height          =   495
      Left            =   6000
      TabIndex        =   5
      Top             =   2160
      Width           =   1215
   End
   Begin VB.CommandButton cmdProcess
      Caption         =   "&Process"
      Default         =   -1  'True
      Height          =   495
      Left            =   6000
      TabIndex        =   4
      Top             =   1440
      Width           =   1215
   End
   Begin VB.TextBox txtResult
      Height          =   315
      Left            =   1920
      Locked          =   -1  'True
      TabIndex        =   3
      Top             =   2280
      Width           =   1095
   End
   Begin VB.TextBox txtNum2
      Height          =   315
      Left            =   1920
      MaxLength       =   7
      TabIndex        =   1
      Top             =   920
      Width           =   1095
   End
   Begin VB.ComboBox cboOp
      Height          =   315
      Left            =   1920
      Style           =   2  'Dropdown List
      TabIndex        =   2
      Top             =   1605
      Width           =   1095
   End
   Begin VB.TextBox txtNum1
      Height          =   315
      Left            =   1920
      MaxLength       =   7
      TabIndex        =   0
      Top             =   240
      Width           =   1095
   End
   Begin VB.Label lblBinResult
      Height          =   315
      Left            =   3360
      TabIndex        =   12
      Top             =   2280
      Width           =   2415
   End
   Begin VB.Label lblBinNum2
      Height          =   315
      Left            =   3360
      TabIndex        =   11
      Top             =   960
      Width           =   2415
   End
   Begin VB.Label lblBinNum1
      Height          =   315
      Left            =   3360
      TabIndex        =   10
      Top             =   240
      Width           =   2415
   End
   Begin VB.Label lblResult
      Caption         =   "Result:"
      Height          =   315
      Left            =   240
      TabIndex        =   9
      Top             =   2280
      Width           =   1215
   End
   Begin VB.Label lblOp
      Caption         =   "Operation:"
      Height          =   315
      Left            =   240
      TabIndex        =   8
      Top             =   1600
      Width           =   1215
   End
   Begin VB.Label lblNum2
      Caption         =   "Number 2:"
      Height          =   315
      Left            =   240
      TabIndex        =   7
      Top             =   920
      Width           =   1215
   End
   Begin VB.Label lblNum1
      Caption         =   "Number 1:"
      Height          =   315
      Left            =   240
      TabIndex        =   6
      Top             =   240
      Width           =   1215
   End
End
Attribute VB_Name = "frmBin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Const DEPTH% = 24
Private Const LIMIT& = 8388608

' Store reference to Bin class
Private mBin As Bin

' Store value of numbers
Private mNum1&, mNum2&

' Store valid status of a number
Private mNum1Valid As Boolean
Private mNum2Valid As Boolean

Private Sub Form_Load()
   
    ' Populate drop-down
    With cboOp
        .AddItem "AND"
        .AddItem "OR"
        .AddItem "XOR"
       
        ' Select the first value
        .ListIndex = 0
    End With
   
    ' Get a reference to Bin library
    Set mBin = New Bin
   
    ' Set boolean valid number status
    mNum1Valid = True
    mNum2Valid = True
   
    ' Set status bar
    stbStatus.SimpleText = "Ready!"
   
End Sub

' PROCESS OPERATION
Private Sub cmdProcess_Click()

    Dim decResult&
    Dim binResult$
   
    ' When both numbers are valid ...
    If CheckNumbers() Then
       
        ' Perform selected operation
        Select Case cboOp.ListIndex
            Case 0
                decResult = mNum1 And mNum2
            Case 1
                decResult = mNum1 Or mNum2
            Case 2
                decResult = mNum1 Xor mNum2
        End Select
       
        ' Get Bit pattern
        binResult = mBin.DecToBin(decResult, DEPTH)
       
        ' Set decimal and binary result
        txtResult.Text = CStr(decResult)
        lblBinResult.Caption = binResult
       
        stbStatus.SimpleText = "Success!"
       
    Else
   
        Call Reset
       
    End If
   
End Sub

Private Sub txtNum1_Change()

    Call ProcessNumber( _
        txtNum1, _
        lblBinNum1, _
        mNum1, _
        mNum1Valid _
    )
   
End Sub

Private Sub txtNum2_Change()

    Call ProcessNumber( _
        txtNum2, _
        lblBinNum2, _
        mNum2, _
        mNum2Valid _
    )
   
End Sub

' MAKE SURE BOTH NUMBERS ARE VALID
Private Function CheckNumbers() As Boolean

    CheckNumbers = True

    ' One invalid number makes the operation invalid
    If mNum1Valid = False Or mNum2Valid = False Then
        CheckNumbers = False
    End If
   
End Function

' RESET FIELDS FOR NEXT OPERATION
Private Sub Reset()
    stbStatus.SimpleText = "Ready!"
    txtResult.Text = ""
    lblBinResult.Caption = ""
   
    mNum1Valid = True
    mNum2Valid = True
End Sub

' GENERIC HANDLER FOR PROCESSING A NUMBER
Private Sub ProcessNumber( _
    txtNum As TextBox, _
    lblBin As Label, _
    num&, _
    valid As Boolean _
)
    On Error GoTo error1
   
    ' Reset prior results
    Call Reset
   
    ' Get Number
    num = CLng(txtNum.Text)
    If num > LIMIT Then GoTo error1
   
    ' Set bit pattern for number
    lblBin.Caption = mBin.DecToBin(CLng(txtNum.Text), DEPTH)

    Exit Sub
error1:
    ' Invalidate number
    If txtNum.Text = "" Then
        lblBin.Caption = ""
    Else
        lblBin.Caption = "INVALID"
    End If
   
    valid = False
End Sub


CD Grab, read CD-audio tracks

68302 UART flow control routine

ManuSoft MkErr Error device for Turbo Pascal 6.0
MkErr let you build an error handler to pascal programs. Your handler is called automatically on error. You can choose in errorhandler what to do then, halt/print message/continue etc..
Download CD Grab, read CD-audio tracks Download 68302 UART flow control routine Download ManuSoft MkErr Error device for Turbo Pascal 6.0 MkErr let you build an error handler to pascal programs. Your  handler is called automatically on error. You can choose in  errorhandler what to do then, halt/print message/continue etc..







Sponsored links

Six Sigma Certification
100% Online-Six Sigma Certificate from Villanova - Find Out More Now.
Localize software in three simple steps
Localize .Net, C/C++ & Delphi apps visually. HTML, HTML Help, XML & databases. Try Sisulizer now!
Localize Delphi software in three simple steps
Localize Delphi VCL & .Net apps visually. Plus HTML, HTML Help, XML & databases. Try Sisulizer now!
Web based bug tracking - AdminiTrack.com
AdminiTrack offers an effective web-based bug tracking system designed for professional software development teams.
Computer Professionals: Are you owed Overtime?
Federal and State Laws may allow computer professionals to collect overtime. Our law firm is experienced, and has initiated class action lawsuits against some of the largest computer companies to collect back pay and overtime. Strictly Confidential.


Newsletter | Submit Content | About | Advertising | Awards | Contact Us | Link to us |
© 1996-2008 Community Networks Ltd All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Synchron Data - .NET development.