' Bit-String Calculator Eqv (XNOR) Demo Program
' Mr. Minich
' Purpose - to illustrate the use of the Eqv operator as it is defined in
'             Visual Basic. It is similar to the logical operation, XNOR.

Option Explicit Private Sub cmdCalculate_Click() Dim J As Integer ' loop variable Dim Bit As String ' a bit from an inputted bit-string For J = 1 To Len(txtBitString1) Bit = Str$(Val(Mid$(txtBitString1, J, 1)) Eqv Val(Mid$(txtBitString2, J, 1))) If Bit = "-1" Then ' Conversion must be made here since Bit = "1" ' the TRUE that is returned by the Else ' Eqv operator is converted to -1 Bit = "0" ' by Visual Basic. End If lblAnswer = lblAnswer & Bit Next J End Sub Private Sub cmdClear_Click() lblAnswer = "" ' clearing the text boxes and labels txtBitString1 = "" txtBitString2 = "" End Sub Private Sub CmdExit_Click() End ' exiting the program End Sub