User talk:S k dey

' ' Form Display '

Sub Main Form.Visible = True End Sub

' ' Initializing values on form load '

txtdsply.Text = "0." ValFrame.Visible = False ConFrame.Visible = False cmdMret.Enabled = False cmdMclr.Enabled = False Option1.visible = False cmdSin.visible = False cmdCos.visible = False cmdTan.visible = False cmdPowxy.visible = False cmdPowx3.visible = False cmdPowx2.visible = False cmdPi.visible = False cmdMod.visible = False cmdA.visible = False cmdB.visible = False cmdC.visible = False cmdD.visible = False cmdE.visible = False cmdF.visible = False cmdA.Enabled = False cmdB.Enabled = False cmdC.Enabled = False cmdD.Enabled = False cmdE.Enabled = False cmdF.Enabled = False Optionhex.visible = False Optionoct.visible = False Optiondec.visible = False Optionbin.visible = False cmdNfact.visible = False cmdLog.visible = False cmdln.visible = False Optiondeg.visible = False Optionrad.visible = False Optiongrads.visible = False cmdSta.Enabled = False cmdSta.Visible = False cmdAve.Enabled = False cmdSum.Enabled = False cmds.Enabled = False cmdDat.Enabled = False cmdAve.visible = False cmdSum.visible = False cmds.visible = False cmdDat.visible = False cmdList.Visible = False cmdRet.Visible = False cmdLoad.Visible = False cmdCd.Visible = False cmdCad.Visible = False cmdExit.Visible = False StaFrame.Visible = False SText.Visible = False cmdInt.visible = False cmdExp.Visible = False cmdAnd.Visible = False cmdOr.Visible = False cmdNot.Visible = False cmdXor.Visible = False Call cmdClr_Click FrameName.Width = 320 FrameName.Height= 290 txtdsply.Width = 290 txtdsply.Height = 25 Form.Width = 332 Form.Height = 330 blnClr = True decflag=false

' ' Variable Declarations '

Dim blnClr Dim bytOprtr Dim dblOpnd1, dblOpnd2 Dim dblRslt, dblMmry, dblCap Dim intDecIndex Dim decflag Dim answerflag Dim ang, i, n Dim counter, Sum, Ave, TempAnswer Dim hexflag, octflag, binflag, deciflag, hexRslt, octRslt, binRslt

' ' Numberkey clicks '

Public Sub cmd0_Click ShowNum(cmd0.caption) End Sub

Public Sub cmd1_Click ShowNum(cmd1.caption) End Sub

Public Sub cmd2_Click ShowNum(cmd2.caption) End Sub

Public Sub cmd3_Click ShowNum(cmd3.caption) End Sub

Public Sub cmd4_Click ShowNum(cmd4.caption) End Sub

Public Sub cmd5_Click ShowNum(cmd5.caption) End Sub

Public Sub cmd6_Click ShowNum(cmd6.caption) End Sub

Public Sub cmd7_Click ShowNum(cmd7.caption) End Sub

Public Sub cmd8_Click ShowNum(cmd8.caption) End Sub

Public Sub cmd9_Click ShowNum(cmd9.caption) End Sub

Public Sub cmdA_Click ShowNum(cmdA.caption) End Sub

Public Sub cmdB_Click ShowNum(cmdB.caption) End Sub

Public Sub cmdC_Click ShowNum(cmd2.caption) End Sub

Public Sub cmdD_Click ShowNum(cmdD.caption) End Sub

Public Sub cmdE_Click ShowNum(cmdE.caption) End Sub

Public Sub cmdF_Click ShowNum(cmdF.caption) End Sub

' ' Decimal point click ' Public Sub cmdDec_Click decflag=true 'To make sure that there can be only one dec point in a number 'intDecIndex = intDecIndex + 1 'oprflag = 0 If decflag=true Then If intDecIndex = 1 Then If blnClr = true Then txtdsply.Text = "0" & "." Else txtdsply.Text = txtdsply.Text & "." End If		blnClr = false End If End if End Sub

' ' "+/-" key '

Public Sub cmdNeg_Click If dblRslt = False Then If Cdbl(txtdsply.Text) > 0 Then txtdsply.Text = "-" & txtdsply.Text ElseIf txtdsply.Text < 0 Then txtdsply.Text = Right(txtdsply.Text, (Len(txtdsply.Text) - 1)) End If End If End Sub

' ' Pi '

Public Sub cmdPi_Click dblRslt = false dblRslt = "3.1415926535897932384626433832795" txtdsply.Text = dblRslt blnClr = False End Sub

' ' Printing numberkey on the display '

Public Sub Shownum(buttons)

If Optionhex.Value = True or Optionoct.Value = True or Optionbin.Value = True Then If txtdsply.Text = "0" Then blnClr = True End If	If blnClr = True Then txtdsply.Text = buttons ElseIf blnClr = False Then txtdsply.Text = txtdsply.Text & buttons End If blnClr = False

Else

Dim result, answer, nextdig If blnClr = True Then txtdsply.Text = "0." blnClr = False End If	If nextdig = True Then If right(txtdsply.Text, 1) = "." Then result = Cdbl(txtdsply.Text, Len(txtdsply.Text) - 1) txtdsply.Text = result Else result = Cdbl(txtdsply.Text) txtdsply.Text = result End If txtdsply.Text = "0." nextdig = False decflag = False End If	If decflag = False Then If txtdsply.text <> "0." then txtdsply.Text = Left(txtdsply.Text, Len(txtdsply.Text) - 1) & buttons & "." Else txtdsply.Text = buttons & "." End If	Else txtdsply.Text = Left(txtdsply.Text, Len(txtdsply.Text)) & buttons End If End If End Sub

' ' Functions for arithmetic operations '

'Addition Public Function funAdd(dblOpnd1, dblOpnd2) funAdd = dblOpnd1 + dblOpnd2 bytOprtr = 0 End Function

'Subtraction Public Function funSub(dblOpnd1, dblOpnd2) funSub = dblOpnd1 - dblOpnd2 bytOprtr = 0 End Function

'Multiplication Public Function funMult(dblOpnd1, dblOpnd2) funMult = dblOpnd1 * dblOpnd2 bytOprtr = 0 End Function

'Division Public Function funDiv(dblOpnd1, dblOpnd2) If dblOpnd2 = 0 Then txtdsply.Text = "Cannot divide by zero!" Call cmdC Else funDiv = dblOpnd1 / dblOpnd2 End If bytOprtr = 0 End Function

'Percentage 'Public Function funMod(dblOpnd1, dblOpnd2) 'funMod = dblOpnd1 mod dblOpnd2 'bytOprtr = 0 'End Function

'X^Y Public Function funPow(dblOpnd1, dblOpnd2) funPow = dblOpnd1 ^ dblOpnd2 bytOprtr = 0 End Function

'Modulus Division Public Function funMod(dblOpnd1, dblOpnd2) funMod = dblOpnd1 Mod dblOpnd2 bytOprtr = 0 End Function

'And Public Function funAnd(dblOpnd1, dblOpnd2) funAnd = dblOpnd1 And dblOpnd2 bytOprtr = 0 End Function

'Or Public Function funOr(dblOpnd1, dblOpnd2) funOr = dblOpnd1 Or dblOpnd2 bytOprtr = 0 End Function

'Xor Public Function funXor(dblOpnd1, dblOpnd2) funXor = dblOpnd1 Xor dblOpnd2 bytOprtr = 0 End Function

' ' "=" key '

Public Sub cmdresult_Click If blnClr= False then dblOpnd2 = Cdbl(txtdsply.Text) Select Case bytOprtr Case 0 intDecIndex = 0 blnClr = True Exit Sub Case 1 dblRslt = funAdd(dblOpnd1, dblOpnd2) answerflag=1 Case 2 dblRslt = funSub(dblOpnd1, dblOpnd2) Case 3 dblRslt = funMult(dblOpnd1, dblOpnd2) Case 4 dblRslt = funDiv(dblOpnd1, dblOpnd2) Case 5 dblRslt = funPow(dblOpnd1, dblOpnd2) Case 6 dblRslt = funMod(dblOpnd1, dblOpnd2) Case 7 dblRslt = funAnd(dblOpnd1, dblOpnd2) Case 8 dblRslt = funOr(dblOpnd1, dblOpnd2) Case 9 dblRslt = funXor(dblOpnd1, dblOpnd2) End Select End if

'This is to put "-" sign for negative number and trim the blank space in case of positive number.

If InStr(dblRslt, ".") < 1 Then If Cdbl(dblRslt) >= 0 Then txtdsply.Text = Trim(Cstr(dblRslt)) & "." Else txtdsply.Text = Cstr(dblRslt) & "." End If

ElseIf InStr(dblRslt, ".") > 1 then If Cdbl(dblRslt) >= 0 Then txtdsply.Text = Trim(Cstr(dblRslt)) Else txtdsply.Text = Cstr(dblRslt) End If End if intDecIndex = 0 blnClr = True End Sub

' ' Operation button clicks '

'Addition Public Sub cmdAdd_Click 'oprflag=1 Call cmdresult_Click dblOpnd1 = Cdbl(txtdsply.Text) bytOprtr = 1 intDecIndex = 0 'If Instr(txtdsply.Text, ".") > 1 Then 'decflag = True 'End If decflag = False blnClr = True End Sub

'Subtraction Public Sub cmdSub_Click Call cmdresult_Click dblOpnd1 = Cdbl(txtdsply.Text) bytOprtr = 2 intDecIndex = 0 decflag = False blnClr = True End Sub

'Multiplication Public Sub cmdMult_Click Call cmdresult_Click dblOpnd1 = Cdbl(txtdsply.Text) bytOprtr = 3 decflag = False intDecIndex = 0 blnClr = True End Sub

'Division Public Sub cmdDiv_Click Call cmdresult_Click dblOpnd1 = Cdbl(txtdsply.Text) bytOprtr = 4 decflag = False intDecIndex = 0 blnClr = True End Sub

'X^Y Public Sub cmdPowxy_Click Call cmdresult_Click dblOpnd1 = Cdbl(txtdsply.Text) bytOprtr = 5 decflag = false intDecIndex = 0 blnClr = True End Sub

'Mod Public Sub cmdMod_Click Call cmdresult_Click dblOpnd1 = Cdbl(txtdsply.Text) bytOprtr = 6 decflag = false intDecIndex = 0 blnClr = True End Sub

'And Public Sub cmdAnd_Click Call cmdresult_Click dblOpnd1 = Cdbl(txtdsply.Text) bytOprtr = 7 decflag = false intDecIndex = 0 blnClr = True End Sub

'Or Public Sub cmdOr_Click Call cmdresult_Click dblOpnd1 = Cdbl(txtdsply.Text) bytOprtr = 8 decflag = false intDecIndex = 0 blnClr = True End Sub

'Xor Public Sub cmdXor_Click Call cmdresult_Click dblOpnd1 = Cdbl(txtdsply.Text) bytOprtr = 9 decflag = false intDecIndex = 0 blnClr = True End Sub

'Reciprocal Public Sub cmdRecp_Click If Cdbl(txtdsply.Text) = 0 Then txtdsply.Text = "Cannot divide by zero!" Call cmdC Else dblRslt = 1 / Cdbl(txtdsply.Text) End If If InStr(dblRslt, ".") < 1 Then txtdsply.Text = CStr(dblRslt) & "." ElseIf InStr(dblRslt, ".") > 1 Then txtdsply.Text = CStr(dblRslt) End If decflag = False blnClr = True intDecIndex = 0 End Sub

'Square root Public Sub cmdSqrt_Click If Cdbl(txtdsply.Text) < 0 Then txtdsply.Text = "Invalid Operation!" Call cmdC Exit Sub End If dblRslt = Sqr(Cdbl(txtdsply.Text)) If InStr(dblRslt, ".") < 1 Then txtdsply.Text = CStr(dblRslt) & "." ElseIf InStr(dblRslt, ".") > 1 Then txtdsply.Text = CStr(dblRslt) End If decflag = False blnClr = True intDecIndex = 0 End Sub

'Sin Public Sub cmdSin_Click If Optiondeg.Value=True then ang = 3.1415926535897932384626433832795 / 180 ElseIf Optionrad.Value=True then ang = 1 ElseIf Optiongrads.Value=True then ang = 3.1415926535897932384626433832795 / 200 Else ang = 3.1415926535897932384626433832795 / 180 End If dblRslt = Sin(Cdbl(txtdsply.Text)*ang) If InStr(dblRslt, ".") < 1 Then txtdsply.Text = CStr(dblRslt) & "." ElseIf InStr(dblRslt, ".") > 1 Then txtdsply.Text = CStr(dblRslt) End If decflag = False blnClr = True intDecIndex = 0 End Sub

'Cos Public Sub cmdCos_Click If Optiondeg.Value=True then ang = 3.1415926535897932384626433832795 / 180 ElseIf Optionrad.Value=True then ang = 1 ElseIf Optiongrads.Value=True then ang = 3.1415926535897932384626433832795 / 200 Else ang = 3.1415926535897932384626433832795 / 180 End If dblRslt = Cos(Cdbl(txtdsply.Text)*ang) If InStr(dblRslt, ".") < 1 Then txtdsply.Text = CStr(dblRslt) & "." ElseIf InStr(dblRslt, ".") > 1 Then txtdsply.Text = CStr(dblRslt) End If decflag = False blnClr = True intDecIndex = 0 End Sub

'Tan Public Sub cmdTan_Click If Optiondeg.Value=True then ang = 3.1415926535897932384626433832795 / 180 ElseIf Optionrad.Value=True then ang = 1 ElseIf Optiongrads.Value=True then ang = 3.1415926535897932384626433832795 / 200 Else ang = 3.1415926535897932384626433832795 / 180 End If dblRslt = Tan(Cdbl(txtdsply.Text)*ang) If InStr(dblRslt, ".") < 1 Then txtdsply.Text = CStr(dblRslt) & "." ElseIf InStr(dblRslt, ".") > 1 Then txtdsply.Text = CStr(dblRslt) End If decflag = False blnClr = True intDecIndex = 0 End Sub

'Power X^3 Public Sub cmdPowx3_Click dblRslt = Cdbl(txtdsply.Text * txtdsply.Text * txtdsply.Text) If InStr(dblRslt, ".") < 1 Then txtdsply.Text = CStr(dblRslt) & "." ElseIf InStr(dblRslt, ".") > 1 Then txtdsply.Text = CStr(dblRslt) End If decflag = False blnClr = True intDecIndex = 0 End Sub

'Power X^2 Public Sub cmdPowx2_Click dblRslt = Cdbl(txtdsply.Text * txtdsply.Text) If InStr(dblRslt, ".") < 1 Then txtdsply.Text = CStr(dblRslt) & "." ElseIf InStr(dblRslt, ".") > 1 Then txtdsply.Text = CStr(dblRslt) End If decflag = False blnClr = True intDecIndex = 0 End Sub

'n! Public Sub cmdNfact_Click dblRslt = Cdbl(txtdsply.Text) n = 1 For i = 1 to dblRslt n = i * n Next If InStr(dblRslt, ".") < 1 Then txtdsply.Text = CStr(dblRslt) & "." ElseIf InStr(dblRslt, ".") > 1 Then txtdsply.Text = CStr(dblRslt) End If decflag = False blnClr = True intDecIndex = 0 End Sub

'log Public Sub cmdLog_Click dblRslt = Log(Cdbl(txtdsply.Text)) / Log(10) If InStr(dblRslt, ".") < 1 Then txtdsply.Text = CStr(dblRslt) & "." ElseIf InStr(dblRslt, ".") > 1 Then txtdsply.Text = CStr(dblRslt) End If decflag = False blnClr = True intDecIndex = 0 End Sub

'ln Public Sub cmdln_Click dblRslt = Log(Cdbl(txtdsply.Text)) If InStr(dblRslt, ".") < 1 Then txtdsply.Text = CStr(dblRslt) & "." ElseIf InStr(dblRslt, ".") > 1 Then txtdsply.Text = CStr(dblRslt) End If decflag = False blnClr = True intDecIndex = 0 End Sub

'Int Public Sub cmdInt_Click dblRslt = Int(txtdsply.Text) & "." If InStr(dblRslt, ".") < 1 Then txtdsply.Text = CStr(dblRslt) & "." ElseIf InStr(dblRslt, ".") > 1 Then txtdsply.Text = CStr(dblRslt) End If decflag = False blnClr = True intDecIndex = 0 End Sub

'Exp Public Sub cmdExp_Click dblRslt = Exp(txtdsply.Text) If InStr(dblRslt, ".") < 1 Then txtdsply.Text = CStr(dblRslt) & "." ElseIf InStr(dblRslt, ".") > 1 Then txtdsply.Text = CStr(dblRslt) End If decflag = False blnClr = True intDecIndex = 0 End Sub

'Not Public Sub cmdNot_Click dblRslt = Not(txtdsply.Text) If InStr(dblRslt, ".") < 1 Then txtdsply.Text = CStr(dblRslt) & "." ElseIf InStr(dblRslt, ".") > 1 Then txtdsply.Text = CStr(dblRslt) End If decflag = False blnClr = True intDecIndex = 0 End Sub

'Percentage Public Sub cmdPer_Click call cmdresult_Click txtdsply.Text = (dblRslt/100) If InStr(txtdsply.Text, ".") < 1 Then txtdsply.Text = txtdsply.Text & "." ElseIf InStr(dblRslt, ".") > 1 Then txtdsply.Text = txtdsply.Text End If decflag = False blnClr = True intDecIndex = 0 End Sub

' ' Conversions '

'Dec Conversion Public Sub Optiondec_Click deciflag = True If hexflag = True Then dblRslt = txtdsply.Text txtdsply.Text = Clng("&H" & dblRslt) & "." hexflag = False ElseIf octflag = True Then dblRslt = txtdsply.Text txtdsply.Text = Clng("&O" & dblRslt) & "." octflag = False ElseIf binflag = True Then dblRslt = txtdsply.Text Dim s			s = Cstr(dblRslt) txtdsply.Text = BinToDec(dblRslt) & "." binflag = True End If	blnClr = True intDecIndex = 0

If Optiondec.Value = True Then cmdA.Enabled = False cmdB.Enabled = False cmdC.Enabled = False cmdD.Enabled = False cmdE.Enabled = False cmdF.Enabled = False cmdMsav.Enabled = True cmdMadd.Enabled = True cmdRecp.Enabled = True cmdDiv.Enabled = True cmdMult.Enabled = True cmdAdd.Enabled = True cmdSub.Enabled = True cmdSqrt.Enabled = True cmdDec.Enabled = True cmdresult.Enabled = True cmdPer.Enabled = True cmdNeg.Enabled = True cmdMret.Enabled = True cmdMclr.Enabled = True cmdSin.Enabled = True cmdCos.Enabled = True cmdTan.Enabled = True cmdPowxy.Enabled = True cmdPowx3.Enabled = True cmdPowx2.Enabled = True cmdPi.Enabled = True cmdMod.Enabled = True cmdNfact.Enabled = True cmdLog.Enabled = True cmdln.Enabled = True Optiondeg.Enabled = True Optionrad.Enabled = True Optiongrads.Enabled = True Option1.Enabled = True cmdSta.Enabled = True cmdInt.Enabled = True cmdExp.Enabled = True cmdAnd.Enabled = True cmdOr.Enabled = True cmdNot.Enabled = True cmdXor.Enabled = True cmd8.Enabled = True cmd9.Enabled = True cmd7.Enabled = True cmd6.Enabled = True cmd5.Enabled = True cmd4.Enabled = True cmd3.Enabled = True cmd2.Enabled = True End If

End Sub

Function BinToDec(s) Dim lngResult Dim intIndex lngResult = 0 For intIndex = Len(s) to 1 Step -1 strDigit = mid(s, intIndex, 1) Select Case strDigit Case "0" 'Do nothing Case "1" lngResult = lngResult + (2 ^ (Len(s)-intIndex)) Case Else 'Invalid lngResult = 0 'Stop the loop intIndex = 0 End Select Next BinToDec = lngResult End Function

'Hex Conversion Public Sub Optionhex_Click hexflag = True If octflag = True Then hexRslt = CLng("&O" & txtdsply.Text) & "." hexRslt = Hex(Cdbl(hexRslt)) txtdsply.Text = Cstr(hexRslt) octflag = False ElseIf binflag = True Then hexRslt = BinToDec(txtdsply.Text) hexRslt = Hex(Cdbl(hexRslt)) txtdsply.Text = Cstr(hexRslt) binflag = False ElseIf deciflag = True Then hexRslt = Hex(Cdbl(txtdsply.Text)) txtdsply.Text = Cstr(hexRslt) deciflag = False End If	blnClr = True intDecIndex = 0

If Optionhex.Value = True Then cmdA.Enabled = True cmdB.Enabled = True cmdC.Enabled = True cmdD.Enabled = True cmdE.Enabled = True cmdF.Enabled = True cmdMsav.Enabled = False cmdMadd.Enabled = False cmdRecp.Enabled = False cmdDiv.Enabled = False cmdMult.Enabled = False cmdAdd.Enabled = False cmdSub.Enabled = False cmdSqrt.Enabled = False cmdDec.Enabled = False cmdresult.Enabled = False cmdPer.Enabled = False cmdNeg.Enabled = False cmdMret.Enabled = False cmdMclr.Enabled = False cmdSin.Enabled = False cmdCos.Enabled = False cmdTan.Enabled = False cmdPowxy.Enabled = False cmdPowx3.Enabled = False cmdPowx2.Enabled = False cmdPi.Enabled = False cmdMod.Enabled = False cmdNfact.Enabled = False cmdLog.Enabled = False cmdln.Enabled = False Optiondeg.Enabled = False Optionrad.Enabled = False Optiongrads.Enabled = False Option1.Enabled = False cmdSta.Enabled = False StaFrame.Visible = False SText.Visible = False cmdAve.Enabled = False cmdSum.Enabled = False cmds.Enabled = False cmdDat.Enabled = False cmdList.Visible = False cmdRet.Visible = False cmdLoad.Visible = False cmdCd.Visible = False cmdCad.Visible = False cmdExit.Visible = False Form.Width = 702 Form.Height = 330 cmdInt.Enabled = False cmdExp.Enabled = False cmdAnd.Enabled = False cmdOr.Enabled = False cmdNot.Enabled = False cmdXor.Enabled = False End If

End Sub

'Oct Conversion Public Sub Optionoct_Click octflag = True If hexflag = True Then octRslt = CLng("&H" & txtdsply.Text) & "." octRslt = Oct(Cdbl(octRslt)) txtdsply.Text = Cstr(octRslt) hexflag = False ElseIf binflag = True Then octRslt = BinToDec(txtdsply.Text) octRslt = oct(Cdbl(octRslt)) txtdsply.Text = Cstr(octRslt) binflag = False ElseIf deciflag = True Then octRslt = Oct(Cdbl(txtdsply.Text)) txtdsply.Text = Cstr(octRslt) deciflag = False End If	blnClr = True intDecIndex = 0

If Optionoct.Value = True Then cmdA.Enabled = False cmdB.Enabled = False cmdC.Enabled = False cmdD.Enabled = False cmdE.Enabled = False cmdF.Enabled = False cmdMsav.Enabled = False cmdMadd.Enabled = False cmdRecp.Enabled = False cmdDiv.Enabled = False cmdMult.Enabled = False cmdAdd.Enabled = False cmdSub.Enabled = False cmdSqrt.Enabled = False cmdDec.Enabled = False cmdresult.Enabled = False cmdPer.Enabled = False cmdNeg.Enabled = False cmdMret.Enabled = False cmdMclr.Enabled = False cmdSin.Enabled = False cmdCos.Enabled = False cmdTan.Enabled = False cmdPowxy.Enabled = False cmdPowx3.Enabled = False cmdPowx2.Enabled = False cmdPi.Enabled = False cmdMod.Enabled = False cmdNfact.Enabled = False cmdLog.Enabled = False cmdln.Enabled = False Optiondeg.Enabled = False Optionrad.Enabled = False Optiongrads.Enabled = False Option1.Enabled = False cmdSta.Enabled = False StaFrame.Visible = False SText.Visible = False cmdAve.Enabled = False cmdSum.Enabled = False cmds.Enabled = False cmdDat.Enabled = False cmdList.Visible = False cmdRet.Visible = False cmdLoad.Visible = False cmdCd.Visible = False cmdCad.Visible = False cmdExit.Visible = False Form.Width = 702 Form.Height = 330 cmdInt.Enabled = False cmdExp.Enabled = False cmdAnd.Enabled = False cmdOr.Enabled = False cmdNot.Enabled = False cmdXor.Enabled = False cmd8.Enabled = False cmd9.Enabled = False End If

End Sub

'Bin Conversion Public Sub Optionbin_Click binflag = True If hexflag = True Then binRslt = CLng("&H" & txtdsply.Text) & "." If txtdsply.Text = "0." Then txtdsply.Text = "0" Else binRslt = Cdbl(binRslt) n = binRslt binRslt = "" While n <> 0 binRslt = n Mod 2 & binRslt n = n \ 2 Wend txtdsply.Text = binRslt End If			txtdsply.Text = Cstr(binRslt) hexflag = False ElseIf octflag = True Then binRslt = CLng("&O" & txtdsply.Text) & "." If txtdsply.Text = "0." Then txtdsply.Text = "0" Else binRslt = Cdbl(binRslt) n = binRslt binRslt = "" While n <> 0 binRslt = n Mod 2 & binRslt n = n \ 2 Wend txtdsply.Text = binRslt End If			txtdsply.Text = Cstr(binRslt) octflag = False ElseIf deciflag = True Then If txtdsply.Text = "0." Then txtdsply.Text = "0" Else binRslt = Cdbl(txtdsply.Text) n = binRslt binRslt = "" While n <> 0 binRslt = n Mod 2 & binRslt n = n \ 2 Wend txtdsply.Text = binRslt End If			deciflag = False End If	blnClr = True intDecIndex = 0

If Optionbin.Value = True Then cmdA.Enabled = False cmdB.Enabled = False cmdC.Enabled = False cmdD.Enabled = False cmdE.Enabled = False cmdF.Enabled = False cmdMsav.Enabled = False cmdMadd.Enabled = False cmdRecp.Enabled = False cmdDiv.Enabled = False cmdMult.Enabled = False cmdAdd.Enabled = False cmdSub.Enabled = False cmdSqrt.Enabled = False cmdDec.Enabled = False cmdresult.Enabled = False cmdPer.Enabled = False cmdNeg.Enabled = False cmdMret.Enabled = False cmdMclr.Enabled = False cmdSin.Enabled = False cmdCos.Enabled = False cmdTan.Enabled = False cmdPowxy.Enabled = False cmdPowx3.Enabled = False cmdPowx2.Enabled = False cmdPi.Enabled = False cmdMod.Enabled = False cmdNfact.Enabled = False cmdLog.Enabled = False cmdln.Enabled = False Optiondeg.Enabled = False Optionrad.Enabled = False Optiongrads.Enabled = False Option1.Enabled = False cmdSta.Enabled = False StaFrame.Visible = False SText.Visible = False cmdAve.Enabled = False cmdSum.Enabled = False cmds.Enabled = False cmdDat.Enabled = False cmdList.Visible = False cmdRet.Visible = False cmdLoad.Visible = False cmdCd.Visible = False cmdCad.Visible = False cmdExit.Visible = False Form.Width = 702 Form.Height = 330 cmdInt.Enabled = False cmdExp.Enabled = False cmdAnd.Enabled = False cmdOr.Enabled = False cmdNot.Enabled = False cmdXor.Enabled = False cmd8.Enabled = False cmd9.Enabled = False cmd7.Enabled = False cmd6.Enabled = False cmd5.Enabled = False cmd4.Enabled = False cmd3.Enabled = False cmd2.Enabled = False End If

End Sub

' ' Statistics Box '

'Sta Public Sub cmdSta_Click cmdAve.Enabled = True cmdSum.Enabled = True cmds.Enabled = True cmdDat.Enabled = True cmdList.Visible = True cmdRet.Visible = True cmdLoad.Visible = True cmdCd.Visible = True cmdCad.Visible = True cmdExit.Visible = True StaFrame.Visible = True SText.Visible = True Form.Width = 702 Form.Height = 520 End Sub

'Dat Public Sub cmdDat_Click cmdList.AddItem txtdsply.Text For counter = 0 To cmdList.ListCount - 1 cmdList.listindex = counter Next blnClr= True decflag = False SText.Text = "n = " & cmdList.ListCount End Sub

'CAD Public Sub cmdCad_Click cmdList.Clear SText.Text = "n = " & cmdList.ListCount End Sub

'LOAD Public Sub cmdLoad_Click Dim SelectItem For SelectItem = (cmdList.ListCount - 1) To 0 Step -1 If cmdList.Selected(SelectItem) Then txtdsply.Text = cmdList End If Next End Sub

'CD Public Sub cmdCd_Click Dim SelectItem For SelectItem = (cmdList.ListCount - 1) To 0 Step -1 If cmdList.Selected(SelectItem) Then cmdList.RemoveItem SelectItem End If Next For counter = 0 To cmdList.ListCount - 1 cmdList.listindex = counter Next SText.Text = "n = " & cmdList.ListCount End Sub

'Sum Public Sub cmdSum_Click Sum = 0 For counter = 0 To cmdList.ListCount - 1 cmdList.listindex = counter Sum = Sum + cmdList.Text Next If InStr(Sum, ".") < 1 Then txtdsply.Text = CStr(Sum) & "." ElseIf InStr(Sum, ".") > 1 Then txtdsply.Text = CStr(Sum) End If End Sub

'Ave Public Sub cmdAve_Click TempAnswer = 0 For counter = 0 To cmdList.ListCount - 1 cmdList.listindex = counter TempAnswer = TempAnswer + cmdList.Text Next Ave = TempAnswer / (cmdList.ListCount) If InStr(Ave, ".") < 1 Then txtdsply.Text = CStr(Ave) & "." ElseIf InStr(Ave, ".") > 1 Then txtdsply.Text = CStr(Ave) End If End Sub

'Standard Deviation Public Sub cmds_Click Dim SumSq, StdDev TempAnswer = 0 SumSq = 0 For counter = 0 To cmdList.ListCount - 1 cmdList.listindex = counter TempAnswer = TempAnswer + cmdList.Text Next Ave = TempAnswer / (cmdList.ListCount) For counter = 0 To cmdList.ListCount - 1 cmdList.listindex = counter SumSq = SumSq + (cmdList.Text - Ave) ^ 2 Next StdDev = Sqr(SumSq / ((cmdList.ListCount) - 1)) If InStr(StdDev, ".") < 1 Then txtdsply.Text = CStr(StdDev) & "." ElseIf InStr(StdDev, ".") > 1 Then txtdsply.Text = CStr(StdDev) End If End Sub

'Exit Public Sub cmdExit_Click cmdList.Clear SText.Text = "n = 0" StaFrame.Visible = False SText.Visible = False cmdAve.Enabled = False cmdSum.Enabled = False cmds.Enabled = False cmdDat.Enabled = False cmdList.Visible = False cmdRet.Visible = False cmdLoad.Visible = False cmdCd.Visible = False cmdCad.Visible = False cmdExit.Visible = False Form.Width = 702 Form.Height = 330 End Sub

'RET Public Sub cmdRet_Click StaFrame.Visible = False SText.Visible = False cmdList.Visible = False cmdRet.Visible = False cmdLoad.Visible = False cmdCd.Visible = False cmdCad.Visible = False cmdExit.Visible = False Form.Width = 702 Form.Height = 330 End Sub

' ' Memory commands '

'Memory Add Public Sub cmdMadd_Click If Cdbl(txtdsply.Text) <> "0" Then dblMmry = dblMmry + Cdbl(txtdsply.Text) cmdMret.Enabled = True cmdMclr.Enabled = True disp.text="M" End If decflag = False intDecIndex = 0 blnClr = True End Sub

'Memory Clear Public Sub cmdMclr_Click dblMmry = 0 cmdMret.Enabled = False cmdMclr.Enabled = False disp.text="" blnClr = True End Sub

'Memory Retrieve Public Sub cmdMret_Click If InStr(dblMmry, ".") < 1 Then txtdsply.Text = CStr(dblMmry) & "." ElseIf InStr(dblMmry, ".") > 1 Then txtdsply.Text = CStr(dblMmry) End If intDecIndex = 0 blnClr = True End Sub

'Memory Save Public Sub cmdMsav_Click If cdbl(txtdsply.Text) <> 0 Then dblMmry = Cdbl(txtdsply.Text) cmdMret.Enabled = True cmdMclr.Enabled = True disp.text="M" End If decflag = False intDecIndex = 0 blnClr = True End Sub

' ' Clear Commands '

'Clear All Public Sub cmdClr_Click If Optionhex.Value= True Then txtdsply.Text = "0" ElseIf Optiondec.Value = True Then txtdsply.Text = "0." ElseIf Optionoct.Value= True Then txtdsply.Text = "0" ElseIf Optionbin.Value = True Then txtdsply.Text = "0" Else txtdsply.Text = "0." End If intDecIndex = 0 dblRslt = 0 bytOprtr = 0 dblOpnd1 = 0 dblOpnd2 = 0 decflag=false blnClr = True End Sub

'Clear Entry Public Sub cmdCE_Click If Optionhex.Value= True Then txtdsply.Text = "0" ElseIf Optiondec.Value = True Then txtdsply.Text = "0." ElseIf Optionoct.Value= True Then txtdsply.Text = "0" ElseIf Optionbin.Value = True Then txtdsply.Text = "0" End If End Sub

'BackSpace Public Sub cmdBckspc_Click If answer <> True And dblRslt = False Then If right(txtdsply.Text,1)<>"." Then txtdsply.Text = left(txtdsply.Text, Len(txtdsply.Text)-1) Else If Len(txtdsply.Text) <> 2 Then txtdsply.Text = left(txtdsply.Text, Len(txtdsply.Text)-2) & "." Else txtdsply.Text = "0." End If	End If End If If txtdsply.Text = "0." Then Call cmdClr_Click End If End Sub

' ' Mode Change '

'Scientific Public Sub Option2_Click If Option2.value = True then Option2.visible = False Option1.visible = True cmdSin.visible = True cmdCos.visible = True cmdTan.visible = True cmdPowxy.visible = True cmdPowx3.visible = True cmdPowx2.visible = True cmdMod.visible = True cmdPi.visible = True Optiondeg.Value=True Optiondec.Value=True Optionhex.visible = True cmdA.visible = True cmdB.visible = True cmdC.visible = True cmdD.visible = True cmdE.visible = True cmdF.visible = True cmdA.Enabled = False cmdB.Enabled = False cmdC.Enabled = False cmdD.Enabled = False cmdE.Enabled = False cmdF.Enabled = False Optionoct.visible = True Optiondec.visible = True Optionbin.visible = True cmdNfact.visible = True cmdLog.visible = True cmdln.visible = True Optiondeg.visible = True Optionrad.visible = True Optiongrads.visible = True cmdSta.Enabled = True cmdSta.Visible = True cmdAve.Enabled = False cmdSum.Enabled = False cmds.Enabled = False cmdDat.Enabled = False cmdAve.visible = True cmdSum.visible = True cmds.visible = True cmdDat.visible = True cmdInt.visible = True cmdExp.Visible = True cmdAnd.Visible = True cmdOr.Visible = True cmdNot.Visible = True cmdXor.Visible = True ValFrame.Visible = True ConFrame.Visible = True FrameName.Width = 690 FrameName.Height= 290 txtdsply.Width = 660 txtdsply.Height = 25 Form.Width = 702 Form.Height = 330 Call cmdClr_Click End If End Sub

'Standard Public Sub Option1_Click If Option1.value = True then Option1.visible = False Option2.visible = True cmdSin.visible = False cmdCos.visible = False cmdTan.visible = False cmdPowxy.visible = False cmdPowx3.visible = False cmdPowx2.visible = False cmdMod.visible = False cmdPi.visible = False Optionhex.visible = False cmdA.visible = False cmdB.visible = False cmdC.visible = False cmdD.visible = False cmdE.visible = False cmdF.visible = False cmdA.Enabled = False cmdB.Enabled = False cmdC.Enabled = False cmdD.Enabled = False cmdE.Enabled = False cmdF.Enabled = False Optionoct.visible = False Optiondec.visible = False Optiondec.Value=True Optionbin.visible = False cmdNfact.visible = False cmdLog.visible = False cmdln.visible = False Optiondeg.visible = False Optionrad.visible = False Optiongrads.visible = False cmdSta.Enabled = False cmdSta.Visible = False cmdAve.visible = False cmdSum.visible = False cmds.visible = False cmdDat.visible = False cmdList.Visible = False cmdRet.Visible = False cmdLoad.Visible = False cmdCd.Visible = False cmdCad.Visible = False cmdExit.Visible = False StaFrame.Visible = False SText.Visible = False cmdInt.visible = False cmdExp.Visible = False cmdAnd.Visible = False cmdOr.Visible = False cmdNot.Visible = False cmdXor.Visible = False ValFrame.Visible = False ConFrame.Visible = False FrameName.Width = 320 FrameName.Height= 290 txtdsply.Width = 290 txtdsply.Height = 25 Form.Width = 332 Form.Height = 330 Call cmdClr_Click End If End Sub