Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class Form1
  2.  
  3.     Dim Binary As String
  4.     Dim BinNum As Integer
  5.     Dim HexOrDec As Integer
  6.     Dim QType As Integer
  7.     Dim Counter As Integer = 0
  8.     Dim Counter2 As Boolean
  9.     Dim Counter3 As Boolean
  10.     Dim BinTo(2) As String
  11.     Dim QuestionType As Integer
  12.     Dim QuestionType2 As Integer
  13.     Dim OutputHexOrDec As String
  14.     Dim BinaryStr As String
  15.     Dim BinaryStr2 As String
  16.     Dim BinaryStr3 As String
  17.     Dim BinaryStr4 As String
  18.     Dim BinaryStr5 As String
  19.     Dim BinaryStr6 As String
  20.     Dim Bit1 As Integer
  21.     Dim Bit2 As Integer
  22.     Dim Bit3 As Integer
  23.     Dim Bit4 As Integer
  24.     Dim Bit5 As Integer
  25.     Dim Bit6 As Integer
  26.     Dim Bit7 As Integer
  27.     Dim Bit8 As Integer
  28.     Dim CarryBit As Integer
  29.     Dim DecAnswer As Integer = 0
  30.     Dim OverallAnswer As String
  31.     Dim HexAnswer As String
  32.     Dim UserAnswer As String
  33.     Dim SumNum1 As Integer
  34.     Dim SumNum2 As Integer
  35.     Dim UnroundedAnswer As Decimal
  36.     Dim BinOrHex As Integer
  37.     Dim DenTo(1) As String
  38.     Dim RandInteger As Integer
  39.     Dim InputType As Boolean
  40.     Dim Score As Integer = 0
  41.  
  42.     Public Function random1(ByRef BinNum As Integer)
  43.  
  44.         Randomize()
  45.         BinNum = Int((Rnd()) * 2)
  46.         Return BinNum
  47.  
  48.     End Function
  49.  
  50.     Public Function random2(ByRef HexOrDec As Integer)
  51.  
  52.         Randomize()
  53.         HexOrDec = CInt(Math.Floor((1 - 0 + 1) * Rnd()))
  54.         Return HexOrDec
  55.  
  56.     End Function
  57.  
  58.     Public Function random3(ByRef QType As Integer)
  59.  
  60.         Randomize()
  61.         QType = CInt(Math.Floor((6 - 0 + 1) * Rnd()))
  62.         Return QType
  63.  
  64.     End Function
  65.  
  66.     Public Function random4(ByRef BinOrHex As Integer)
  67.  
  68.         Randomize()
  69.         BinOrHex = CInt(Math.Floor((1 - 0 + 1) * Rnd()))
  70.         Return BinOrHex
  71.  
  72.     End Function
  73.  
  74.     Public Function random5(ByRef RandInteger As Integer)
  75.  
  76.         Randomize()
  77.         RandInteger = CInt(Math.Floor((255 - 0 + 1) * Rnd()))
  78.         Return RandInteger
  79.  
  80.     End Function
  81.  
  82.     Public Function random6(ByRef QType As Integer)
  83.  
  84.         Randomize()
  85.         QType = CInt(Math.Floor((2 - 0 + 1) * Rnd()))
  86.         Return QType
  87.  
  88.     End Function
  89.  
  90.     Public Function random7(ByRef QType As Integer)
  91.  
  92.         Randomize()
  93.         QType = CInt(Math.Floor((5 - 0 + 1) * Rnd()))
  94.         Return QType
  95.  
  96.     End Function
  97.  
  98.     Private Sub RichTextBox3_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles RichTextBox3.KeyPress
  99.         If Not (Asc(e.KeyChar) = 8) Or (Asc(e.KeyChar) = 13) Then
  100.             If Not ((Asc(e.KeyChar) >= 48 And Asc(e.KeyChar) <= 57) Or Asc(e.KeyChar) = 46 Or (Asc(e.KeyChar) >= 65 And Asc(e.KeyChar) <= 70) Or Asc(e.KeyChar) = 45) Then
  101.                 e.KeyChar = ChrW(0)
  102.                 e.Handled = True
  103.             End If
  104.         End If
  105.  
  106.         If (Asc(e.KeyChar) = 13) Then
  107.             AnswerThing()
  108.         End If
  109.  
  110.     End Sub
  111.  
  112.  
  113.     Private Sub Questions(ByRef BinNum As Integer, ByRef HexOrDec As Integer, ByRef QType As Integer, ByRef BinaryStr As String, ByRef InputType As Boolean)
  114.         RichTextBox2.SelectionAlignment = HorizontalAlignment.Center
  115.         RichTextBox4.SelectionAlignment = HorizontalAlignment.Center
  116.         RichTextBox5.SelectionAlignment = HorizontalAlignment.Center
  117.         If CheckBox1.Checked = True Then
  118.             QuestionType = random3(QType)
  119.         Else
  120.             QuestionType = random7(QType)
  121.         End If
  122.         QuestionType2 = random6(QType)
  123.         If InputType = False Then
  124.             If QuestionType = 0 Then
  125.                 BinTo(0) = "Denary?"
  126.                 BinTo(1) = "Hexadecimal?"
  127.                 Counter = 0
  128.                 RichTextBox2.Clear()
  129.                 RichTextBox2.AppendText("What is ")
  130.                 Do
  131.                     random1(BinNum)
  132.                     RichTextBox2.AppendText(BinNum)
  133.                     Counter = Counter + 1
  134.                     BinaryStr = BinaryStr + BinNum.ToString
  135.                 Loop Until Counter = 8
  136.                 RichTextBox2.AppendText(" in ")
  137.                 random2(HexOrDec)
  138.                 OutputHexOrDec = BinTo(HexOrDec)
  139.                 RichTextBox2.AppendText(OutputHexOrDec)
  140.             ElseIf QuestionType = 1 Then
  141.                 Counter = 0
  142.                 RichTextBox2.Clear()
  143.                 RichTextBox2.AppendText("What is ")
  144.                 Do
  145.                     random1(BinNum)
  146.                     RichTextBox2.AppendText(BinNum)
  147.                     Counter = Counter + 1
  148.                     BinaryStr = BinaryStr + BinNum.ToString
  149.                 Loop Until Counter = 8
  150.                 Counter = 0
  151.                 RichTextBox2.AppendText(" + ")
  152.                 Do
  153.                     random1(BinNum)
  154.                     RichTextBox2.AppendText(BinNum)
  155.                     Counter = Counter + 1
  156.                     BinaryStr2 = BinaryStr2 + BinNum.ToString
  157.                 Loop Until Counter = 8
  158.                 RichTextBox2.AppendText("?")
  159.             ElseIf QuestionType = 2 Then
  160.                 Counter = 0
  161.                 RichTextBox2.Clear()
  162.                 RichTextBox2.AppendText("What is ")
  163.                 Do
  164.                     random1(BinNum)
  165.                     RichTextBox2.AppendText(BinNum)
  166.                     Counter = Counter + 1
  167.                     BinaryStr = BinaryStr + BinNum.ToString
  168.                 Loop Until Counter = 8
  169.                 Counter = 0
  170.                 RichTextBox2.AppendText(" - ")
  171.                 Do
  172.                     random1(BinNum)
  173.                     RichTextBox2.AppendText(BinNum)
  174.                     Counter = Counter + 1
  175.                     BinaryStr2 = BinaryStr2 + BinNum.ToString
  176.                 Loop Until Counter = 8
  177.                 RichTextBox2.AppendText("?")
  178.             ElseIf QuestionType = 3 Then
  179.                 Counter = 0
  180.                 RichTextBox2.Clear()
  181.                 RichTextBox2.AppendText("What is ")
  182.                 Do
  183.                     random1(BinNum)
  184.                     RichTextBox2.AppendText(BinNum)
  185.                     Counter = Counter + 1
  186.                     BinaryStr = BinaryStr + BinNum.ToString
  187.                 Loop Until Counter = 8
  188.                 Counter = 0
  189.                 RichTextBox2.AppendText(" x ")
  190.                 Do
  191.                     random1(BinNum)
  192.                     RichTextBox2.AppendText(BinNum)
  193.                     Counter = Counter + 1
  194.                     BinaryStr2 = BinaryStr2 + BinNum.ToString
  195.                 Loop Until Counter = 8
  196.                 RichTextBox2.AppendText("?")
  197.             ElseIf QuestionType = 4 Then
  198.                 Counter = 0
  199.                 RichTextBox2.Clear()
  200.                 TextBox1.Visible = True
  201.                 RichTextBox2.AppendText("What is ")
  202.                 Do
  203.                     random1(BinNum)
  204.                     RichTextBox2.AppendText(BinNum)
  205.                     Counter = Counter + 1
  206.                     BinaryStr = BinaryStr + BinNum.ToString
  207.                 Loop Until Counter = 8
  208.                 Counter = 0
  209.                 RichTextBox2.AppendText(" / ")
  210.                 Do
  211.                     Counter = 0
  212.                     Do
  213.                         random1(BinNum)
  214.                         RichTextBox2.AppendText(BinNum)
  215.                         Counter = Counter + 1
  216.                         BinaryStr2 = BinaryStr2 + BinNum.ToString
  217.                     Loop Until Counter = 8
  218.                 Loop Until BinaryStr2 <> "00000000"
  219.                 RichTextBox2.AppendText("?")
  220.             ElseIf QuestionType = 5 Then
  221.                 DenTo(0) = "Binary?"
  222.                 DenTo(1) = "Hexadecimal?"
  223.                 Counter = 0
  224.                 RichTextBox2.Clear()
  225.                 RichTextBox2.AppendText("What is ")
  226.                 random5(RandInteger)
  227.                 RichTextBox2.AppendText(RandInteger & " in ")
  228.                 random4(BinOrHex)
  229.                 RichTextBox2.AppendText(DenTo(BinOrHex))
  230.             ElseIf QuestionType = 6 Then
  231.                 Panel3.Visible = True
  232.                 Counter = 0
  233.                 RichTextBox2.Clear()
  234.                 RichTextBox2.Visible = False
  235.                 Do
  236.                     Panel3.Visible = True
  237.                     Mantissa1.Text = ""
  238.                     Mantissa2.Text = ""
  239.                     Mantissa3.Text = ""
  240.                     Mantissa4.Text = ""
  241.                     Mantissa5.Text = ""
  242.                     Mantissa6.Text = ""
  243.                     Mantissa7.Text = ""
  244.                     Mantissa8.Text = ""
  245.                     Exponent1.Text = ""
  246.                     Exponent2.Text = ""
  247.                     Exponent3.Text = ""
  248.                     Exponent4.Text = ""
  249.                     BinaryStr = ""
  250.                     Counter = 0
  251.                     Do
  252.                         random1(BinNum)
  253.                         Select Case Counter
  254.                             Case 0
  255.                                 Mantissa1.Text = BinNum
  256.                             Case 1
  257.                                 Mantissa2.Text = BinNum
  258.                             Case 2
  259.                                 Mantissa3.Text = BinNum
  260.                             Case 3
  261.                                 Mantissa4.Text = BinNum
  262.                             Case 4
  263.                                 Mantissa5.Text = BinNum
  264.                             Case 5
  265.                                 Mantissa6.Text = BinNum
  266.                             Case 6
  267.                                 Mantissa7.Text = BinNum
  268.                             Case 7
  269.                                 Mantissa8.Text = BinNum
  270.                             Case 8
  271.                                 Exponent1.Text = BinNum
  272.                             Case 9
  273.                                 Exponent2.Text = BinNum
  274.                             Case 10
  275.                                 Exponent3.Text = BinNum
  276.                             Case 11
  277.                                 Exponent4.Text = BinNum
  278.                         End Select
  279.                         Counter = Counter + 1
  280.                         BinaryStr = BinaryStr + BinNum.ToString
  281.                     Loop Until Counter = 16
  282.                 Loop Until BinaryStr.StartsWith("10") Or BinaryStr.StartsWith("01")
  283.             End If
  284.         ElseIf InputType = True Then
  285.             If QuestionType2 = 0 Then
  286.                 Do
  287.                     BinaryStr = ""
  288.                     BinaryStr2 = ""
  289.                     Counter = 0
  290.                     RichTextBox2.Clear()
  291.                     RichTextBox2.AppendText("What is ")
  292.                     Do
  293.                         random1(BinNum)
  294.                         RichTextBox2.AppendText(BinNum)
  295.                         Counter = Counter + 1
  296.                         BinaryStr = BinaryStr + BinNum.ToString
  297.                     Loop Until Counter = 8
  298.                     Counter = 0
  299.                     RichTextBox2.AppendText(" + ")
  300.                     Do
  301.                         random1(BinNum)
  302.                         RichTextBox2.AppendText(BinNum)
  303.                         Counter = Counter + 1
  304.                         BinaryStr2 = BinaryStr2 + BinNum.ToString
  305.                     Loop Until Counter = 8
  306.                     RichTextBox2.AppendText("?")
  307.                     Answers(HexOrDec, BinaryStr, DecAnswer, OverallAnswer, HexAnswer, QuestionType, BinaryStr2, SumNum1, SumNum2, UnroundedAnswer, BinOrHex, BinaryStr5)
  308.                 Loop Until CarryBit = 0
  309.             ElseIf QuestionType2 = 1 Then
  310.                 Do
  311.                     BinaryStr = ""
  312.                     BinaryStr2 = ""
  313.                     Counter = 0
  314.                     RichTextBox2.Clear()
  315.                     RichTextBox2.AppendText("What is ")
  316.                     Do
  317.                         random1(BinNum)
  318.                         RichTextBox2.AppendText(BinNum)
  319.                         Counter = Counter + 1
  320.                         BinaryStr = BinaryStr + BinNum.ToString
  321.                     Loop Until Counter = 8
  322.                     Counter = 0
  323.                     RichTextBox2.AppendText(" - ")
  324.                     Do
  325.                         random1(BinNum)
  326.                         RichTextBox2.AppendText(BinNum)
  327.                         Counter = Counter + 1
  328.                         BinaryStr2 = BinaryStr2 + BinNum.ToString
  329.                     Loop Until Counter = 8
  330.                     RichTextBox2.AppendText("?")
  331.                 Loop Until Counter = 8
  332.             ElseIf QuestionType2 = 2 Then
  333.                 Counter = 0
  334.                 BinOrHex = 0
  335.                 RichTextBox2.AppendText("What is ")
  336.                 random5(RandInteger)
  337.                 RichTextBox2.AppendText(RandInteger & " in Binary?")
  338.             End If
  339.         End If
  340.     End Sub
  341.  
  342.     Public Function Answers(ByRef HexOrDec As Integer, ByRef BinaryStr As String, ByVal DecAnswer As Integer, ByVal OverallAnswer As String, ByVal HexAnswer As String, ByRef QuestionType As Integer, ByVal BinaryStr2 As String, ByVal SumNum1 As Integer, ByVal SumNum2 As Integer, ByVal UnroundedAnswer As Decimal, ByRef BinOrHex As Integer, ByVal BinaryStr5 As String)
  343.         If InputType = False Then
  344.             If QuestionType = 0 Then
  345.                 If HexOrDec = 0 Then
  346.                     If BinaryStr(0) = "1" Then
  347.                         DecAnswer += 128
  348.                     Else
  349.                         DecAnswer += 0
  350.                     End If
  351.                     If BinaryStr(1) = "1" Then
  352.                         DecAnswer += 64
  353.                     Else
  354.                         DecAnswer += 0
  355.                     End If
  356.                     If BinaryStr(2) = "1" Then
  357.                         DecAnswer += 32
  358.                     Else
  359.                         DecAnswer += 0
  360.                     End If
  361.                     If BinaryStr(3) = "1" Then
  362.                         DecAnswer += 16
  363.                     Else
  364.                         DecAnswer += 0
  365.                     End If
  366.                     If BinaryStr(4) = "1" Then
  367.                         DecAnswer += 8
  368.                     Else
  369.                         DecAnswer += 0
  370.                     End If
  371.                     If BinaryStr(5) = "1" Then
  372.                         DecAnswer += 4
  373.                     Else
  374.                         DecAnswer += 0
  375.                     End If
  376.                     If BinaryStr(6) = "1" Then
  377.                         DecAnswer += 2
  378.                     Else
  379.                         DecAnswer += 0
  380.                     End If
  381.                     If BinaryStr(7) = "1" Then
  382.                         DecAnswer += 1
  383.                     Else
  384.                         DecAnswer += 0
  385.                     End If
  386.                     OverallAnswer = DecAnswer.ToString
  387.                 ElseIf HexOrDec = 1 Then
  388.                     If BinaryStr(0) = "1" Then
  389.                         If BinaryStr(1) = "1" Then
  390.                             If BinaryStr(2) = "1" Then
  391.                                 If BinaryStr(3) = "1" Then
  392.                                     HexAnswer += "F"
  393.                                 Else
  394.                                     HexAnswer += "E"
  395.                                 End If
  396.                             Else
  397.                                 If BinaryStr(3) = "1" Then
  398.                                     HexAnswer += "D"
  399.                                 Else
  400.                                     HexAnswer += "C"
  401.                                 End If
  402.                             End If
  403.                         Else
  404.                             If BinaryStr(2) = "1" Then
  405.                                 If BinaryStr(3) = "1" Then
  406.                                     HexAnswer += "B"
  407.                                 Else
  408.                                     HexAnswer += "A"
  409.                                 End If
  410.                             Else
  411.                                 If BinaryStr(3) = "1" Then
  412.                                     HexAnswer += "9"
  413.                                 Else
  414.                                     HexAnswer += "8"
  415.                                 End If
  416.                             End If
  417.                         End If
  418.                     Else
  419.                         If BinaryStr(1) = "1" Then
  420.                             If BinaryStr(2) = "1" Then
  421.                                 If BinaryStr(3) = "1" Then
  422.                                     HexAnswer += "7"
  423.                                 Else
  424.                                     HexAnswer += "6"
  425.                                 End If
  426.                             Else
  427.                                 If BinaryStr(3) = "1" Then
  428.                                     HexAnswer += "5"
  429.                                 Else
  430.                                     HexAnswer += "4"
  431.                                 End If
  432.                             End If
  433.                         Else
  434.                             If BinaryStr(2) = "1" Then
  435.                                 If BinaryStr(3) = "1" Then
  436.                                     HexAnswer += "3"
  437.                                 Else
  438.                                     HexAnswer += "2"
  439.                                 End If
  440.                             Else
  441.                                 If BinaryStr(3) = "1" Then
  442.                                     HexAnswer += "1"
  443.                                 Else
  444.                                     HexAnswer += "0"
  445.                                 End If
  446.                             End If
  447.                         End If
  448.                     End If
  449.                     If BinaryStr(4) = "1" Then
  450.                         If BinaryStr(5) = "1" Then
  451.                             If BinaryStr(6) = "1" Then
  452.                                 If BinaryStr(7) = "1" Then
  453.                                     HexAnswer += "F"
  454.                                 Else
  455.                                     HexAnswer += "E"
  456.                                 End If
  457.                             Else
  458.                                 If BinaryStr(7) = "1" Then
  459.                                     HexAnswer += "D"
  460.                                 Else
  461.                                     HexAnswer += "C"
  462.                                 End If
  463.                             End If
  464.                         Else
  465.                             If BinaryStr(6) = "1" Then
  466.                                 If BinaryStr(7) = "1" Then
  467.                                     HexAnswer += "B"
  468.                                 Else
  469.                                     HexAnswer += "A"
  470.                                 End If
  471.                             Else
  472.                                 If BinaryStr(7) = "1" Then
  473.                                     HexAnswer += "9"
  474.                                 Else
  475.                                     HexAnswer += "8"
  476.                                 End If
  477.                             End If
  478.                         End If
  479.                     Else
  480.                         If BinaryStr(5) = "1" Then
  481.                             If BinaryStr(6) = "1" Then
  482.                                 If BinaryStr(7) = "1" Then
  483.                                     HexAnswer += "7"
  484.                                 Else
  485.                                     HexAnswer += "6"
  486.                                 End If
  487.                             Else
  488.                                 If BinaryStr(7) = "1" Then
  489.                                     HexAnswer += "5"
  490.                                 Else
  491.                                     HexAnswer += "4"
  492.                                 End If
  493.                             End If
  494.                         Else
  495.                             If BinaryStr(6) = "1" Then
  496.                                 If BinaryStr(7) = "1" Then
  497.                                     HexAnswer += "3"
  498.                                 Else
  499.                                     HexAnswer += "2"
  500.                                 End If
  501.                             Else
  502.                                 If BinaryStr(7) = "1" Then
  503.                                     HexAnswer += "1"
  504.                                 Else
  505.                                     HexAnswer += "0"
  506.                                 End If
  507.                             End If
  508.                         End If
  509.                     End If
  510.                     OverallAnswer = HexAnswer
  511.                 ElseIf HexOrDec = 2 Then
  512.  
  513.                 Else
  514.                     RichTextBox2.AppendText("Error")
  515.                 End If
  516.             ElseIf QuestionType = 1 Then
  517.                 If BinaryStr(0) = "1" Then
  518.                     SumNum1 += 128
  519.                 Else
  520.                     SumNum1 += 0
  521.                 End If
  522.                 If BinaryStr(1) = "1" Then
  523.                     SumNum1 += 64
  524.                 Else
  525.                     SumNum1 += 0
  526.                 End If
  527.                 If BinaryStr(2) = "1" Then
  528.                     SumNum1 += 32
  529.                 Else
  530.                     SumNum1 += 0
  531.                 End If
  532.                 If BinaryStr(3) = "1" Then
  533.                     SumNum1 += 16
  534.                 Else
  535.                     SumNum1 += 0
  536.                 End If
  537.                 If BinaryStr(4) = "1" Then
  538.                     SumNum1 += 8
  539.                 Else
  540.                     SumNum1 += 0
  541.                 End If
  542.                 If BinaryStr(5) = "1" Then
  543.                     SumNum1 += 4
  544.                 Else
  545.                     SumNum1 += 0
  546.                 End If
  547.                 If BinaryStr(6) = "1" Then
  548.                     SumNum1 += 2
  549.                 Else
  550.                     SumNum1 += 0
  551.                 End If
  552.                 If BinaryStr(7) = "1" Then
  553.                     SumNum1 += 1
  554.                 Else
  555.                     SumNum1 += 0
  556.                 End If
  557.                 If BinaryStr2(0) = "1" Then
  558.                     SumNum2 += 128
  559.                 Else
  560.                     SumNum2 += 0
  561.                 End If
  562.                 If BinaryStr2(1) = "1" Then
  563.                     SumNum2 += 64
  564.                 Else
  565.                     SumNum2 += 0
  566.                 End If
  567.                 If BinaryStr2(2) = "1" Then
  568.                     SumNum2 += 32
  569.                 Else
  570.                     SumNum2 += 0
  571.                 End If
  572.                 If BinaryStr2(3) = "1" Then
  573.                     SumNum2 += 16
  574.                 Else
  575.                     SumNum2 += 0
  576.                 End If
  577.                 If BinaryStr2(4) = "1" Then
  578.                     SumNum2 += 8
  579.                 Else
  580.                     SumNum2 += 0
  581.                 End If
  582.                 If BinaryStr2(5) = "1" Then
  583.                     SumNum2 += 4
  584.                 Else
  585.                     SumNum2 += 0
  586.                 End If
  587.                 If BinaryStr2(6) = "1" Then
  588.                     SumNum2 += 2
  589.                 Else
  590.                     SumNum2 += 0
  591.                 End If
  592.                 If BinaryStr2(7) = "1" Then
  593.                     SumNum2 += 1
  594.                 Else
  595.                     SumNum2 += 0
  596.                 End If
  597.                 OverallAnswer = SumNum1 + SumNum2
  598.             ElseIf QuestionType = 2 Then
  599.                 If BinaryStr(0) = "1" Then
  600.                     SumNum1 += 128
  601.                 Else
  602.                     SumNum1 += 0
  603.                 End If
  604.                 If BinaryStr(1) = "1" Then
  605.                     SumNum1 += 64
  606.                 Else
  607.                     SumNum1 += 0
  608.                 End If
  609.                 If BinaryStr(2) = "1" Then
  610.                     SumNum1 += 32
  611.                 Else
  612.                     SumNum1 += 0
  613.                 End If
  614.                 If BinaryStr(3) = "1" Then
  615.                     SumNum1 += 16
  616.                 Else
  617.                     SumNum1 += 0
  618.                 End If
  619.                 If BinaryStr(4) = "1" Then
  620.                     SumNum1 += 8
  621.                 Else
  622.                     SumNum1 += 0
  623.                 End If
  624.                 If BinaryStr(5) = "1" Then
  625.                     SumNum1 += 4
  626.                 Else
  627.                     SumNum1 += 0
  628.                 End If
  629.                 If BinaryStr(6) = "1" Then
  630.                     SumNum1 += 2
  631.                 Else
  632.                     SumNum1 += 0
  633.                 End If
  634.                 If BinaryStr(7) = "1" Then
  635.                     SumNum1 += 1
  636.                 Else
  637.                     SumNum1 += 0
  638.                 End If
  639.                 If BinaryStr2(0) = "1" Then
  640.                     SumNum2 += 128
  641.                 Else
  642.                     SumNum2 += 0
  643.                 End If
  644.                 If BinaryStr2(1) = "1" Then
  645.                     SumNum2 += 64
  646.                 Else
  647.                     SumNum2 += 0
  648.                 End If
  649.                 If BinaryStr2(2) = "1" Then
  650.                     SumNum2 += 32
  651.                 Else
  652.                     SumNum2 += 0
  653.                 End If
  654.                 If BinaryStr2(3) = "1" Then
  655.                     SumNum2 += 16
  656.                 Else
  657.                     SumNum2 += 0
  658.                 End If
  659.                 If BinaryStr2(4) = "1" Then
  660.                     SumNum2 += 8
  661.                 Else
  662.                     SumNum2 += 0
  663.                 End If
  664.                 If BinaryStr2(5) = "1" Then
  665.                     SumNum2 += 4
  666.                 Else
  667.                     SumNum2 += 0
  668.                 End If
  669.                 If BinaryStr2(6) = "1" Then
  670.                     SumNum2 += 2
  671.                 Else
  672.                     SumNum2 += 0
  673.                 End If
  674.                 If BinaryStr2(7) = "1" Then
  675.                     SumNum2 += 1
  676.                 Else
  677.                     SumNum2 += 0
  678.                 End If
  679.                 OverallAnswer = SumNum1 - SumNum2
  680.             ElseIf QuestionType = 3 Then
  681.                 If BinaryStr(0) = "1" Then
  682.                     SumNum1 += 128
  683.                 Else
  684.                     SumNum1 += 0
  685.                 End If
  686.                 If BinaryStr(1) = "1" Then
  687.                     SumNum1 += 64
  688.                 Else
  689.                     SumNum1 += 0
  690.                 End If
  691.                 If BinaryStr(2) = "1" Then
  692.                     SumNum1 += 32
  693.                 Else
  694.                     SumNum1 += 0
  695.                 End If
  696.                 If BinaryStr(3) = "1" Then
  697.                     SumNum1 += 16
  698.                 Else
  699.                     SumNum1 += 0
  700.                 End If
  701.                 If BinaryStr(4) = "1" Then
  702.                     SumNum1 += 8
  703.                 Else
  704.                     SumNum1 += 0
  705.                 End If
  706.                 If BinaryStr(5) = "1" Then
  707.                     SumNum1 += 4
  708.                 Else
  709.                     SumNum1 += 0
  710.                 End If
  711.                 If BinaryStr(6) = "1" Then
  712.                     SumNum1 += 2
  713.                 Else
  714.                     SumNum1 += 0
  715.                 End If
  716.                 If BinaryStr(7) = "1" Then
  717.                     SumNum1 += 1
  718.                 Else
  719.                     SumNum1 += 0
  720.                 End If
  721.                 If BinaryStr2(0) = "1" Then
  722.                     SumNum2 += 128
  723.                 Else
  724.                     SumNum2 += 0
  725.                 End If
  726.                 If BinaryStr2(1) = "1" Then
  727.                     SumNum2 += 64
  728.                 Else
  729.                     SumNum2 += 0
  730.                 End If
  731.                 If BinaryStr2(2) = "1" Then
  732.                     SumNum2 += 32
  733.                 Else
  734.                     SumNum2 += 0
  735.                 End If
  736.                 If BinaryStr2(3) = "1" Then
  737.                     SumNum2 += 16
  738.                 Else
  739.                     SumNum2 += 0
  740.                 End If
  741.                 If BinaryStr2(4) = "1" Then
  742.                     SumNum2 += 8
  743.                 Else
  744.                     SumNum2 += 0
  745.                 End If
  746.                 If BinaryStr2(5) = "1" Then
  747.                     SumNum2 += 4
  748.                 Else
  749.                     SumNum2 += 0
  750.                 End If
  751.                 If BinaryStr2(6) = "1" Then
  752.                     SumNum2 += 2
  753.                 Else
  754.                     SumNum2 += 0
  755.                 End If
  756.                 If BinaryStr2(7) = "1" Then
  757.                     SumNum2 += 1
  758.                 Else
  759.                     SumNum2 += 0
  760.                 End If
  761.                 OverallAnswer = SumNum1 * SumNum2
  762.             ElseIf QuestionType = 4 Then
  763.                 If BinaryStr(0) = "1" Then
  764.                     SumNum1 += 128
  765.                 Else
  766.                     SumNum1 += 0
  767.                 End If
  768.                 If BinaryStr(1) = "1" Then
  769.                     SumNum1 += 64
  770.                 Else
  771.                     SumNum1 += 0
  772.                 End If
  773.                 If BinaryStr(2) = "1" Then
  774.                     SumNum1 += 32
  775.                 Else
  776.                     SumNum1 += 0
  777.                 End If
  778.                 If BinaryStr(3) = "1" Then
  779.                     SumNum1 += 16
  780.                 Else
  781.                     SumNum1 += 0
  782.                 End If
  783.                 If BinaryStr(4) = "1" Then
  784.                     SumNum1 += 8
  785.                 Else
  786.                     SumNum1 += 0
  787.                 End If
  788.                 If BinaryStr(5) = "1" Then
  789.                     SumNum1 += 4
  790.                 Else
  791.                     SumNum1 += 0
  792.                 End If
  793.                 If BinaryStr(6) = "1" Then
  794.                     SumNum1 += 2
  795.                 Else
  796.                     SumNum1 += 0
  797.                 End If
  798.                 If BinaryStr(7) = "1" Then
  799.                     SumNum1 += 1
  800.                 Else
  801.                     SumNum1 += 0
  802.                 End If
  803.                 If BinaryStr2(0) = "1" Then
  804.                     SumNum2 += 128
  805.                 Else
  806.                     SumNum2 += 0
  807.                 End If
  808.                 If BinaryStr2(1) = "1" Then
  809.                     SumNum2 += 64
  810.                 Else
  811.                     SumNum2 += 0
  812.                 End If
  813.                 If BinaryStr2(2) = "1" Then
  814.                     SumNum2 += 32
  815.                 Else
  816.                     SumNum2 += 0
  817.                 End If
  818.                 If BinaryStr2(3) = "1" Then
  819.                     SumNum2 += 16
  820.                 Else
  821.                     SumNum2 += 0
  822.                 End If
  823.                 If BinaryStr2(4) = "1" Then
  824.                     SumNum2 += 8
  825.                 Else
  826.                     SumNum2 += 0
  827.                 End If
  828.                 If BinaryStr2(5) = "1" Then
  829.                     SumNum2 += 4
  830.                 Else
  831.                     SumNum2 += 0
  832.                 End If
  833.                 If BinaryStr2(6) = "1" Then
  834.                     SumNum2 += 2
  835.                 Else
  836.                     SumNum2 += 0
  837.                 End If
  838.                 If BinaryStr2(7) = "1" Then
  839.                     SumNum2 += 1
  840.                 Else
  841.                     SumNum2 += 0
  842.                 End If
  843.                 UnroundedAnswer = SumNum1 / SumNum2
  844.                 OverallAnswer = Math.Round(UnroundedAnswer, 2, MidpointRounding.AwayFromZero)
  845.             ElseIf QuestionType = 5 Then
  846.                 If BinOrHex = 0 Then
  847.                     If RandInteger >= 128 Then
  848.                         BinaryStr += "1"
  849.                         RandInteger -= 128
  850.                     Else
  851.                         BinaryStr += "0"
  852.                     End If
  853.                     If RandInteger >= 64 Then
  854.                         BinaryStr += "1"
  855.                         RandInteger -= 64
  856.                     Else
  857.                         BinaryStr += "0"
  858.                     End If
  859.                     If RandInteger >= 32 Then
  860.                         BinaryStr += "1"
  861.                         RandInteger -= 32
  862.                     Else
  863.                         BinaryStr += "0"
  864.                     End If
  865.                     If RandInteger >= 16 Then
  866.                         BinaryStr += "1"
  867.                         RandInteger -= 16
  868.                     Else
  869.                         BinaryStr += "0"
  870.                     End If
  871.                     If RandInteger >= 8 Then
  872.                         BinaryStr += "1"
  873.                         RandInteger -= 8
  874.                     Else
  875.                         BinaryStr += "0"
  876.                     End If
  877.                     If RandInteger >= 4 Then
  878.                         BinaryStr += "1"
  879.                         RandInteger -= 4
  880.                     Else
  881.                         BinaryStr += "0"
  882.                     End If
  883.                     If RandInteger >= 2 Then
  884.                         BinaryStr += "1"
  885.                         RandInteger -= 2
  886.                     Else
  887.                         BinaryStr += "0"
  888.                     End If
  889.                     If RandInteger >= 1 Then
  890.                         BinaryStr += "1"
  891.                         RandInteger -= 1
  892.                     Else
  893.                         BinaryStr += "0"
  894.                     End If
  895.                     OverallAnswer = BinaryStr
  896.                 ElseIf BinOrHex = 1 Then
  897.                     If RandInteger >= 128 Then
  898.                         BinaryStr += "1"
  899.                         RandInteger -= 128
  900.                     Else
  901.                         BinaryStr += "0"
  902.                     End If
  903.                     If RandInteger >= 64 Then
  904.                         BinaryStr += "1"
  905.                         RandInteger -= 64
  906.                     Else
  907.                         BinaryStr += "0"
  908.                     End If
  909.                     If RandInteger >= 32 Then
  910.                         BinaryStr += "1"
  911.                         RandInteger -= 32
  912.                     Else
  913.                         BinaryStr += "0"
  914.                     End If
  915.                     If RandInteger >= 16 Then
  916.                         BinaryStr += "1"
  917.                         RandInteger -= 16
  918.                     Else
  919.                         BinaryStr += "0"
  920.                     End If
  921.                     If RandInteger >= 8 Then
  922.                         BinaryStr += "1"
  923.                         RandInteger -= 8
  924.                     Else
  925.                         BinaryStr += "0"
  926.                     End If
  927.                     If RandInteger >= 4 Then
  928.                         BinaryStr += "1"
  929.                         RandInteger -= 4
  930.                     Else
  931.                         BinaryStr += "0"
  932.                     End If
  933.                     If RandInteger >= 2 Then
  934.                         BinaryStr += "1"
  935.                         RandInteger -= 2
  936.                     Else
  937.                         BinaryStr += "0"
  938.                     End If
  939.                     If RandInteger >= 1 Then
  940.                         BinaryStr += "1"
  941.                         RandInteger -= 1
  942.                     Else
  943.                         BinaryStr += "0"
  944.                     End If
  945.                     If BinaryStr(0) = "1" Then
  946.                         If BinaryStr(1) = "1" Then
  947.                             If BinaryStr(2) = "1" Then
  948.                                 If BinaryStr(3) = "1" Then
  949.                                     HexAnswer += "F"
  950.                                 Else
  951.                                     HexAnswer += "E"
  952.                                 End If
  953.                             Else
  954.                                 If BinaryStr(3) = "1" Then
  955.                                     HexAnswer += "D"
  956.                                 Else
  957.                                     HexAnswer += "C"
  958.                                 End If
  959.                             End If
  960.                         Else
  961.                             If BinaryStr(2) = "1" Then
  962.                                 If BinaryStr(3) = "1" Then
  963.                                     HexAnswer += "B"
  964.                                 Else
  965.                                     HexAnswer += "A"
  966.                                 End If
  967.                             Else
  968.                                 If BinaryStr(3) = "1" Then
  969.                                     HexAnswer += "9"
  970.                                 Else
  971.                                     HexAnswer += "8"
  972.                                 End If
  973.                             End If
  974.                         End If
  975.                     Else
  976.                         If BinaryStr(1) = "1" Then
  977.                             If BinaryStr(2) = "1" Then
  978.                                 If BinaryStr(3) = "1" Then
  979.                                     HexAnswer += "7"
  980.                                 Else
  981.                                     HexAnswer += "6"
  982.                                 End If
  983.                             Else
  984.                                 If BinaryStr(3) = "1" Then
  985.                                     HexAnswer += "5"
  986.                                 Else
  987.                                     HexAnswer += "4"
  988.                                 End If
  989.                             End If
  990.                         Else
  991.                             If BinaryStr(2) = "1" Then
  992.                                 If BinaryStr(3) = "1" Then
  993.                                     HexAnswer += "3"
  994.                                 Else
  995.                                     HexAnswer += "2"
  996.                                 End If
  997.                             Else
  998.                                 If BinaryStr(3) = "1" Then
  999.                                     HexAnswer += "1"
  1000.                                 Else
  1001.                                     HexAnswer += "0"
  1002.                                 End If
  1003.                             End If
  1004.                         End If
  1005.                     End If
  1006.                     If BinaryStr(4) = "1" Then
  1007.                         If BinaryStr(5) = "1" Then
  1008.                             If BinaryStr(6) = "1" Then
  1009.                                 If BinaryStr(7) = "1" Then
  1010.                                     HexAnswer += "F"
  1011.                                 Else
  1012.                                     HexAnswer += "E"
  1013.                                 End If
  1014.                             Else
  1015.                                 If BinaryStr(7) = "1" Then
  1016.                                     HexAnswer += "D"
  1017.                                 Else
  1018.                                     HexAnswer += "C"
  1019.                                 End If
  1020.                             End If
  1021.                         Else
  1022.                             If BinaryStr(6) = "1" Then
  1023.                                 If BinaryStr(7) = "1" Then
  1024.                                     HexAnswer += "B"
  1025.                                 Else
  1026.                                     HexAnswer += "A"
  1027.                                 End If
  1028.                             Else
  1029.                                 If BinaryStr(7) = "1" Then
  1030.                                     HexAnswer += "9"
  1031.                                 Else
  1032.                                     HexAnswer += "8"
  1033.                                 End If
  1034.                             End If
  1035.                         End If
  1036.                     Else
  1037.                         If BinaryStr(5) = "1" Then
  1038.                             If BinaryStr(6) = "1" Then
  1039.                                 If BinaryStr(7) = "1" Then
  1040.                                     HexAnswer += "7"
  1041.                                 Else
  1042.                                     HexAnswer += "6"
  1043.                                 End If
  1044.                             Else
  1045.                                 If BinaryStr(7) = "1" Then
  1046.                                     HexAnswer += "5"
  1047.                                 Else
  1048.                                     HexAnswer += "4"
  1049.                                 End If
  1050.                             End If
  1051.                         Else
  1052.                             If BinaryStr(6) = "1" Then
  1053.                                 If BinaryStr(7) = "1" Then
  1054.                                     HexAnswer += "3"
  1055.                                 Else
  1056.                                     HexAnswer += "2"
  1057.                                 End If
  1058.                             Else
  1059.                                 If BinaryStr(7) = "1" Then
  1060.                                     HexAnswer += "1"
  1061.                                 Else
  1062.                                     HexAnswer += "0"
  1063.                                 End If
  1064.                             End If
  1065.                         End If
  1066.                     End If
  1067.                     OverallAnswer = HexAnswer
  1068.                 End If
  1069.             ElseIf QuestionType = 6 Then
  1070.  
  1071.             End If
  1072.         ElseIf InputType = True Then
  1073.             If QuestionType2 = 0 Then
  1074.                 CarryBit = 0
  1075.                 If BinaryStr(7) = "0" And BinaryStr2(7) = "0" Then
  1076.                     Bit8 = 0
  1077.                 ElseIf BinaryStr(7) = "1" And BinaryStr2(7) = "0" Then
  1078.                     Bit8 = 1
  1079.                 ElseIf BinaryStr(7) = "0" And BinaryStr2(7) = "1" Then
  1080.                     Bit8 = 1
  1081.                 ElseIf BinaryStr(7) = "1" And BinaryStr2(7) = "1" Then
  1082.                     Bit8 = 0
  1083.                     CarryBit = 1
  1084.                 End If
  1085.                 If BinaryStr(6) = "0" And BinaryStr2(6) = "0" Then
  1086.                     If CarryBit = 0 Then
  1087.                         Bit7 = 0
  1088.                     ElseIf CarryBit = 1 Then
  1089.                         Bit7 = 1
  1090.                         CarryBit = 0
  1091.                     End If
  1092.                 ElseIf BinaryStr(6) = "1" And BinaryStr2(6) = "0" Then
  1093.                     If CarryBit = 0 Then
  1094.                         Bit7 = 1
  1095.                     ElseIf CarryBit = 1 Then
  1096.                         Bit7 = 0
  1097.                         CarryBit = 1
  1098.                     End If
  1099.                 ElseIf BinaryStr(6) = "0" And BinaryStr2(6) = "1" Then
  1100.                     If CarryBit = 0 Then
  1101.                         Bit7 = 1
  1102.                     ElseIf CarryBit = 1 Then
  1103.                         Bit7 = 0
  1104.                         CarryBit = 1
  1105.                     End If
  1106.                 ElseIf BinaryStr(6) = "1" And BinaryStr2(6) = "1" Then
  1107.                     If CarryBit = 0 Then
  1108.                         Bit7 = 0
  1109.                         CarryBit = 1
  1110.                     ElseIf CarryBit = 1 Then
  1111.                         Bit7 = 1
  1112.                         CarryBit = 1
  1113.                     End If
  1114.                 End If
  1115.                 If BinaryStr(5) = "0" And BinaryStr2(5) = "0" Then
  1116.                     If CarryBit = 0 Then
  1117.                         Bit6 = 0
  1118.                     ElseIf CarryBit = 1 Then
  1119.                         Bit6 = 1
  1120.                         CarryBit = 0
  1121.                     End If
  1122.                 ElseIf BinaryStr(5) = "1" And BinaryStr2(5) = "0" Then
  1123.                     If CarryBit = 0 Then
  1124.                         Bit6 = 1
  1125.                     ElseIf CarryBit = 1 Then
  1126.                         Bit6 = 0
  1127.                         CarryBit = 1
  1128.                     End If
  1129.                 ElseIf BinaryStr(5) = "0" And BinaryStr2(5) = "1" Then
  1130.                     If CarryBit = 0 Then
  1131.                         Bit6 = 1
  1132.                     ElseIf CarryBit = 1 Then
  1133.                         Bit6 = 0
  1134.                         CarryBit = 1
  1135.                     End If
  1136.                 ElseIf BinaryStr(5) = "1" And BinaryStr2(5) = "1" Then
  1137.                     If CarryBit = 0 Then
  1138.                         Bit6 = 0
  1139.                         CarryBit = 1
  1140.                     ElseIf CarryBit = 1 Then
  1141.                         Bit6 = 1
  1142.                         CarryBit = 1
  1143.                     End If
  1144.                 End If
  1145.                 If BinaryStr(4) = "0" And BinaryStr2(4) = "0" Then
  1146.                     If CarryBit = 0 Then
  1147.                         Bit5 = 0
  1148.                     ElseIf CarryBit = 1 Then
  1149.                         Bit5 = 1
  1150.                         CarryBit = 0
  1151.                     End If
  1152.                 ElseIf BinaryStr(4) = "1" And BinaryStr2(4) = "0" Then
  1153.                     If CarryBit = 0 Then
  1154.                         Bit5 = 1
  1155.                     ElseIf CarryBit = 1 Then
  1156.                         Bit5 = 0
  1157.                         CarryBit = 1
  1158.                     End If
  1159.                 ElseIf BinaryStr(4) = "0" And BinaryStr2(4) = "1" Then
  1160.                     If CarryBit = 0 Then
  1161.                         Bit5 = 1
  1162.                     ElseIf CarryBit = 1 Then
  1163.                         Bit5 = 0
  1164.                         CarryBit = 1
  1165.                     End If
  1166.                 ElseIf BinaryStr(4) = "1" And BinaryStr2(4) = "1" Then
  1167.                     If CarryBit = 0 Then
  1168.                         Bit5 = 0
  1169.                         CarryBit = 1
  1170.                     ElseIf CarryBit = 1 Then
  1171.                         Bit5 = 1
  1172.                         CarryBit = 1
  1173.                     End If
  1174.                 End If
  1175.                 If BinaryStr(3) = "0" And BinaryStr2(3) = "0" Then
  1176.                     If CarryBit = 0 Then
  1177.                         Bit4 = 0
  1178.                     ElseIf CarryBit = 1 Then
  1179.                         Bit4 = 1
  1180.                         CarryBit = 0
  1181.                     End If
  1182.                 ElseIf BinaryStr(3) = "1" And BinaryStr2(3) = "0" Then
  1183.                     If CarryBit = 0 Then
  1184.                         Bit4 = 1
  1185.                     ElseIf CarryBit = 1 Then
  1186.                         Bit4 = 0
  1187.                         CarryBit = 1
  1188.                     End If
  1189.                 ElseIf BinaryStr(3) = "0" And BinaryStr2(3) = "1" Then
  1190.                     If CarryBit = 0 Then
  1191.                         Bit4 = 1
  1192.                     ElseIf CarryBit = 1 Then
  1193.                         Bit4 = 0
  1194.                         CarryBit = 1
  1195.                     End If
  1196.                 ElseIf BinaryStr(3) = "1" And BinaryStr2(3) = "1" Then
  1197.                     If CarryBit = 0 Then
  1198.                         Bit4 = 0
  1199.                         CarryBit = 1
  1200.                     ElseIf CarryBit = 1 Then
  1201.                         Bit4 = 1
  1202.                         CarryBit = 1
  1203.                     End If
  1204.                 End If
  1205.                 If BinaryStr(2) = "0" And BinaryStr2(2) = "0" Then
  1206.                     If CarryBit = 0 Then
  1207.                         Bit3 = 0
  1208.                     ElseIf CarryBit = 1 Then
  1209.                         Bit3 = 1
  1210.                         CarryBit = 0
  1211.                     End If
  1212.                 ElseIf BinaryStr(2) = "1" And BinaryStr2(2) = "0" Then
  1213.                     If CarryBit = 0 Then
  1214.                         Bit3 = 1
  1215.                     ElseIf CarryBit = 1 Then
  1216.                         Bit3 = 0
  1217.                         CarryBit = 1
  1218.                     End If
  1219.                 ElseIf BinaryStr(2) = "0" And BinaryStr2(2) = "1" Then
  1220.                     If CarryBit = 0 Then
  1221.                         Bit3 = 1
  1222.                     ElseIf CarryBit = 1 Then
  1223.                         Bit3 = 0
  1224.                         CarryBit = 1
  1225.                     End If
  1226.                 ElseIf BinaryStr(2) = "1" And BinaryStr2(2) = "1" Then
  1227.                     If CarryBit = 0 Then
  1228.                         Bit3 = 0
  1229.                         CarryBit = 1
  1230.                     ElseIf CarryBit = 1 Then
  1231.                         Bit3 = 1
  1232.                         CarryBit = 1
  1233.                     End If
  1234.                 End If
  1235.                 If BinaryStr(1) = "0" And BinaryStr2(1) = "0" Then
  1236.                     If CarryBit = 0 Then
  1237.                         Bit2 = 0
  1238.                     ElseIf CarryBit = 1 Then
  1239.                         Bit2 = 1
  1240.                         CarryBit = 0
  1241.                     End If
  1242.                 ElseIf BinaryStr(1) = "1" And BinaryStr2(1) = "0" Then
  1243.                     If CarryBit = 0 Then
  1244.                         Bit2 = 1
  1245.                     ElseIf CarryBit = 1 Then
  1246.                         Bit2 = 0
  1247.                         CarryBit = 1
  1248.                     End If
  1249.                 ElseIf BinaryStr(1) = "0" And BinaryStr2(1) = "1" Then
  1250.                     If CarryBit = 0 Then
  1251.                         Bit2 = 1
  1252.                     ElseIf CarryBit = 1 Then
  1253.                         Bit2 = 0
  1254.                         CarryBit = 1
  1255.                     End If
  1256.                 ElseIf BinaryStr(1) = "1" And BinaryStr2(1) = "1" Then
  1257.                     If CarryBit = 0 Then
  1258.                         Bit2 = 0
  1259.                         CarryBit = 1
  1260.                     ElseIf CarryBit = 1 Then
  1261.                         Bit2 = 1
  1262.                         CarryBit = 1
  1263.                     End If
  1264.                 End If
  1265.                 If BinaryStr(0) = "0" And BinaryStr2(0) = "0" Then
  1266.                     If CarryBit = 0 Then
  1267.                         Bit1 = 0
  1268.                     ElseIf CarryBit = 1 Then
  1269.                         Bit1 = 1
  1270.                         CarryBit = 0
  1271.                     End If
  1272.                 ElseIf BinaryStr(0) = "1" And BinaryStr2(0) = "0" Then
  1273.                     If CarryBit = 0 Then
  1274.                         Bit1 = 1
  1275.                     ElseIf CarryBit = 1 Then
  1276.                         Bit1 = 0
  1277.                         CarryBit = 1
  1278.                     End If
  1279.                 ElseIf BinaryStr(0) = "0" And BinaryStr2(0) = "1" Then
  1280.                     If CarryBit = 0 Then
  1281.                         Bit1 = 1
  1282.                     ElseIf CarryBit = 1 Then
  1283.                         Bit1 = 0
  1284.                         CarryBit = 1
  1285.                     End If
  1286.                 ElseIf BinaryStr(0) = "1" And BinaryStr2(0) = "1" Then
  1287.                     If CarryBit = 0 Then
  1288.                         Bit1 = 0
  1289.                         CarryBit = 1
  1290.                     ElseIf CarryBit = 1 Then
  1291.                         Bit1 = 1
  1292.                         CarryBit = 1
  1293.                     End If
  1294.                 End If
  1295.                 BinaryStr5 = Bit1 & Bit2 & Bit3 & Bit4 & Bit5 & Bit6 & Bit7 & Bit8
  1296.                 OverallAnswer = BinaryStr5
  1297.             ElseIf QuestionType2 = 1 Then
  1298.                 If BinaryStr2(7) = "1" Then
  1299.                     Bit8 = 1
  1300.                     If BinaryStr2(6) = "0" Then
  1301.                         Bit7 = 1
  1302.                     ElseIf BinaryStr2(6) = "1" Then
  1303.                         Bit7 = 0
  1304.                     End If
  1305.                     If BinaryStr2(5) = "0" Then
  1306.                         Bit6 = 1
  1307.                     ElseIf BinaryStr2(5) = "1" Then
  1308.                         Bit6 = 0
  1309.                     End If
  1310.                     If BinaryStr2(4) = "0" Then
  1311.                         Bit5 = 1
  1312.                     ElseIf BinaryStr2(4) = "1" Then
  1313.                         Bit5 = 0
  1314.                     End If
  1315.                     If BinaryStr2(3) = "0" Then
  1316.                         Bit4 = 1
  1317.                     ElseIf BinaryStr2(3) = "1" Then
  1318.                         Bit4 = 0
  1319.                     End If
  1320.                     If BinaryStr2(2) = "0" Then
  1321.                         Bit3 = 1
  1322.                     ElseIf BinaryStr2(2) = "1" Then
  1323.                         Bit3 = 0
  1324.                     End If
  1325.                     If BinaryStr2(1) = "0" Then
  1326.                         Bit2 = 1
  1327.                     ElseIf BinaryStr2(1) = "1" Then
  1328.                         Bit2 = 0
  1329.                     End If
  1330.                     If BinaryStr2(0) = "0" Then
  1331.                         Bit1 = 1
  1332.                     ElseIf BinaryStr2(0) = "1" Then
  1333.                         Bit1 = 0
  1334.                     End If
  1335.                     BinaryStr6 = Bit1 & Bit2 & Bit3 & Bit4 & Bit5 & Bit6 & Bit7 & Bit8
  1336.                 ElseIf BinaryStr2(7) = "0" Then
  1337.                     Bit8 = 0
  1338.                     If BinaryStr2(6) = "1" Then
  1339.                         Bit7 = 1
  1340.                         If BinaryStr2(5) = "0" Then
  1341.                             Bit6 = 1
  1342.                         ElseIf BinaryStr2(5) = "1" Then
  1343.                             Bit6 = 0
  1344.                         End If
  1345.                         If BinaryStr2(4) = "0" Then
  1346.                             Bit5 = 1
  1347.                         ElseIf BinaryStr2(4) = "1" Then
  1348.                             Bit5 = 0
  1349.                         End If
  1350.                         If BinaryStr2(3) = "0" Then
  1351.                             Bit4 = 1
  1352.                         ElseIf BinaryStr2(3) = "1" Then
  1353.                             Bit4 = 0
  1354.                         End If
  1355.                         If BinaryStr2(2) = "0" Then
  1356.                             Bit3 = 1
  1357.                         ElseIf BinaryStr2(2) = "1" Then
  1358.                             Bit3 = 0
  1359.                         End If
  1360.                         If BinaryStr2(1) = "0" Then
  1361.                             Bit2 = 1
  1362.                         ElseIf BinaryStr2(1) = "1" Then
  1363.                             Bit2 = 0
  1364.                         End If
  1365.                         If BinaryStr2(0) = "0" Then
  1366.                             Bit1 = 1
  1367.                         ElseIf BinaryStr2(0) = "1" Then
  1368.                             Bit1 = 0
  1369.                         End If
  1370.                         BinaryStr6 = Bit1 & Bit2 & Bit3 & Bit4 & Bit5 & Bit6 & Bit7 & Bit8
  1371.                     ElseIf BinaryStr2(6) = "0" Then
  1372.                         Bit7 = 0
  1373.                         If BinaryStr2(5) = "1" Then
  1374.                             Bit6 = 1
  1375.                             If BinaryStr2(4) = "0" Then
  1376.                                 Bit5 = 1
  1377.                             ElseIf BinaryStr2(4) = "1" Then
  1378.                                 Bit5 = 0
  1379.                             End If
  1380.                             If BinaryStr2(3) = "0" Then
  1381.                                 Bit4 = 1
  1382.                             ElseIf BinaryStr2(3) = "1" Then
  1383.                                 Bit4 = 0
  1384.                             End If
  1385.                             If BinaryStr2(2) = "0" Then
  1386.                                 Bit3 = 1
  1387.                             ElseIf BinaryStr2(2) = "1" Then
  1388.                                 Bit3 = 0
  1389.                             End If
  1390.                             If BinaryStr2(1) = "0" Then
  1391.                                 Bit2 = 1
  1392.                             ElseIf BinaryStr2(1) = "1" Then
  1393.                                 Bit2 = 0
  1394.                             End If
  1395.                             If BinaryStr2(0) = "0" Then
  1396.                                 Bit1 = 1
  1397.                             ElseIf BinaryStr2(0) = "1" Then
  1398.                                 Bit1 = 0
  1399.                             End If
  1400.                             BinaryStr6 = Bit1 & Bit2 & Bit3 & Bit4 & Bit5 & Bit6 & Bit7 & Bit8
  1401.                         ElseIf BinaryStr2(5) = "0" Then
  1402.                             Bit6 = 0
  1403.                             If BinaryStr2(4) = "1" Then
  1404.                                 Bit5 = 1
  1405.                                 If BinaryStr2(3) = "0" Then
  1406.                                     Bit4 = 1
  1407.                                 ElseIf BinaryStr2(3) = "1" Then
  1408.                                     Bit4 = 0
  1409.                                 End If
  1410.                                 If BinaryStr2(2) = "0" Then
  1411.                                     Bit3 = 1
  1412.                                 ElseIf BinaryStr2(2) = "1" Then
  1413.                                     Bit3 = 0
  1414.                                 End If
  1415.                                 If BinaryStr2(1) = "0" Then
  1416.                                     Bit2 = 1
  1417.                                 ElseIf BinaryStr2(1) = "1" Then
  1418.                                     Bit2 = 0
  1419.                                 End If
  1420.                                 If BinaryStr2(0) = "0" Then
  1421.                                     Bit1 = 1
  1422.                                 ElseIf BinaryStr2(0) = "1" Then
  1423.                                     Bit1 = 0
  1424.                                 End If
  1425.                                 BinaryStr6 = Bit1 & Bit2 & Bit3 & Bit4 & Bit5 & Bit6 & Bit7 & Bit8
  1426.                             ElseIf BinaryStr2(4) = "0" Then
  1427.                                 Bit5 = 0
  1428.                                 If BinaryStr2(3) = "1" Then
  1429.                                     Bit4 = 1
  1430.                                     If BinaryStr2(2) = "0" Then
  1431.                                         Bit3 = 1
  1432.                                     ElseIf BinaryStr2(2) = "1" Then
  1433.                                         Bit3 = 0
  1434.                                     End If
  1435.                                     If BinaryStr2(1) = "0" Then
  1436.                                         Bit2 = 1
  1437.                                     ElseIf BinaryStr2(1) = "1" Then
  1438.                                         Bit2 = 0
  1439.                                     End If
  1440.                                     If BinaryStr2(0) = "0" Then
  1441.                                         Bit1 = 1
  1442.                                     ElseIf BinaryStr2(0) = "1" Then
  1443.                                         Bit1 = 0
  1444.                                     End If
  1445.                                     BinaryStr6 = Bit1 & Bit2 & Bit3 & Bit4 & Bit5 & Bit6 & Bit7 & Bit8
  1446.                                 ElseIf BinaryStr2(3) = "0" Then
  1447.                                     Bit4 = 0
  1448.                                     If BinaryStr2(2) = "1" Then
  1449.                                         Bit3 = 1
  1450.                                         If BinaryStr2(1) = "0" Then
  1451.                                             Bit2 = 1
  1452.                                         ElseIf BinaryStr2(1) = "1" Then
  1453.                                             Bit2 = 0
  1454.                                         End If
  1455.                                         If BinaryStr2(0) = "0" Then
  1456.                                             Bit1 = 1
  1457.                                         ElseIf BinaryStr2(0) = "1" Then
  1458.                                             Bit1 = 0
  1459.                                         End If
  1460.                                         BinaryStr6 = Bit1 & Bit2 & Bit3 & Bit4 & Bit5 & Bit6 & Bit7 & Bit8
  1461.                                     ElseIf BinaryStr2(2) = "0" Then
  1462.                                         Bit3 = 0
  1463.                                         If BinaryStr2(1) = "1" Then
  1464.                                             Bit2 = 1
  1465.                                             If BinaryStr2(0) = "0" Then
  1466.                                                 Bit1 = 1
  1467.                                             ElseIf BinaryStr2(0) = "1" Then
  1468.                                                 Bit1 = 0
  1469.                                             End If
  1470.                                             BinaryStr6 = Bit1 & Bit2 & Bit3 & Bit4 & Bit5 & Bit6 & Bit7 & Bit8
  1471.                                         ElseIf BinaryStr2(2) = "0" Then
  1472.                                             Bit2 = 0
  1473.                                             If BinaryStr2(1) = "1" Then
  1474.                                                 Bit1 = 1
  1475.                                                 BinaryStr6 = Bit1 & Bit2 & Bit3 & Bit4 & Bit5 & Bit6 & Bit7 & Bit8
  1476.                                             ElseIf BinaryStr2(2) = "0" Then
  1477.                                                 Bit1 = 0
  1478.                                                 BinaryStr6 = Bit1 & Bit2 & Bit3 & Bit4 & Bit5 & Bit6 & Bit7 & Bit8
  1479.                                             End If
  1480.                                         End If
  1481.                                     End If
  1482.                                 End If
  1483.                             End If
  1484.                         End If
  1485.                     End If
  1486.                 End If
  1487.                 CarryBit = 0
  1488.                 If BinaryStr(7) = "0" And BinaryStr6(7) = "0" Then
  1489.                     Bit8 = 0
  1490.                 ElseIf BinaryStr(7) = "1" And BinaryStr6(7) = "0" Then
  1491.                     Bit8 = 1
  1492.                 ElseIf BinaryStr(7) = "0" And BinaryStr6(7) = "1" Then
  1493.                     Bit8 = 1
  1494.                 ElseIf BinaryStr(7) = "1" And BinaryStr6(7) = "1" Then
  1495.                     Bit8 = 0
  1496.                     CarryBit = 1
  1497.                 End If
  1498.                 If BinaryStr(6) = "0" And BinaryStr6(6) = "0" Then
  1499.                     If CarryBit = 0 Then
  1500.                         Bit7 = 0
  1501.                     ElseIf CarryBit = 1 Then
  1502.                         Bit7 = 1
  1503.                         CarryBit = 0
  1504.                     End If
  1505.                 ElseIf BinaryStr(6) = "1" And BinaryStr6(6) = "0" Then
  1506.                     If CarryBit = 0 Then
  1507.                         Bit7 = 1
  1508.                     ElseIf CarryBit = 1 Then
  1509.                         Bit7 = 0
  1510.                         CarryBit = 1
  1511.                     End If
  1512.                 ElseIf BinaryStr(6) = "0" And BinaryStr6(6) = "1" Then
  1513.                     If CarryBit = 0 Then
  1514.                         Bit7 = 1
  1515.                     ElseIf CarryBit = 1 Then
  1516.                         Bit7 = 0
  1517.                         CarryBit = 1
  1518.                     End If
  1519.                 ElseIf BinaryStr(6) = "1" And BinaryStr6(6) = "1" Then
  1520.                     If CarryBit = 0 Then
  1521.                         Bit7 = 0
  1522.                         CarryBit = 1
  1523.                     ElseIf CarryBit = 1 Then
  1524.                         Bit7 = 1
  1525.                         CarryBit = 1
  1526.                     End If
  1527.                 End If
  1528.                 If BinaryStr(5) = "0" And BinaryStr6(5) = "0" Then
  1529.                     If CarryBit = 0 Then
  1530.                         Bit6 = 0
  1531.                     ElseIf CarryBit = 1 Then
  1532.                         Bit6 = 1
  1533.                         CarryBit = 0
  1534.                     End If
  1535.                 ElseIf BinaryStr(5) = "1" And BinaryStr6(5) = "0" Then
  1536.                     If CarryBit = 0 Then
  1537.                         Bit6 = 1
  1538.                     ElseIf CarryBit = 1 Then
  1539.                         Bit6 = 0
  1540.                         CarryBit = 1
  1541.                     End If
  1542.                 ElseIf BinaryStr(5) = "0" And BinaryStr6(5) = "1" Then
  1543.                     If CarryBit = 0 Then
  1544.                         Bit6 = 1
  1545.                     ElseIf CarryBit = 1 Then
  1546.                         Bit6 = 0
  1547.                         CarryBit = 1
  1548.                     End If
  1549.                 ElseIf BinaryStr(5) = "1" And BinaryStr6(5) = "1" Then
  1550.                     If CarryBit = 0 Then
  1551.                         Bit6 = 0
  1552.                         CarryBit = 1
  1553.                     ElseIf CarryBit = 1 Then
  1554.                         Bit6 = 1
  1555.                         CarryBit = 1
  1556.                     End If
  1557.                 End If
  1558.                 If BinaryStr(4) = "0" And BinaryStr6(4) = "0" Then
  1559.                     If CarryBit = 0 Then
  1560.                         Bit5 = 0
  1561.                     ElseIf CarryBit = 1 Then
  1562.                         Bit5 = 1
  1563.                         CarryBit = 0
  1564.                     End If
  1565.                 ElseIf BinaryStr(4) = "1" And BinaryStr6(4) = "0" Then
  1566.                     If CarryBit = 0 Then
  1567.                         Bit5 = 1
  1568.                     ElseIf CarryBit = 1 Then
  1569.                         Bit5 = 0
  1570.                         CarryBit = 1
  1571.                     End If
  1572.                 ElseIf BinaryStr(4) = "0" And BinaryStr6(4) = "1" Then
  1573.                     If CarryBit = 0 Then
  1574.                         Bit5 = 1
  1575.                     ElseIf CarryBit = 1 Then
  1576.                         Bit5 = 0
  1577.                         CarryBit = 1
  1578.                     End If
  1579.                 ElseIf BinaryStr(4) = "1" And BinaryStr6(4) = "1" Then
  1580.                     If CarryBit = 0 Then
  1581.                         Bit5 = 0
  1582.                         CarryBit = 1
  1583.                     ElseIf CarryBit = 1 Then
  1584.                         Bit5 = 1
  1585.                         CarryBit = 1
  1586.                     End If
  1587.                 End If
  1588.                 If BinaryStr(3) = "0" And BinaryStr6(3) = "0" Then
  1589.                     If CarryBit = 0 Then
  1590.                         Bit4 = 0
  1591.                     ElseIf CarryBit = 1 Then
  1592.                         Bit4 = 1
  1593.                         CarryBit = 0
  1594.                     End If
  1595.                 ElseIf BinaryStr(3) = "1" And BinaryStr6(3) = "0" Then
  1596.                     If CarryBit = 0 Then
  1597.                         Bit4 = 1
  1598.                     ElseIf CarryBit = 1 Then
  1599.                         Bit4 = 0
  1600.                         CarryBit = 1
  1601.                     End If
  1602.                 ElseIf BinaryStr(3) = "0" And BinaryStr6(3) = "1" Then
  1603.                     If CarryBit = 0 Then
  1604.                         Bit4 = 1
  1605.                     ElseIf CarryBit = 1 Then
  1606.                         Bit4 = 0
  1607.                         CarryBit = 1
  1608.                     End If
  1609.                 ElseIf BinaryStr(3) = "1" And BinaryStr6(3) = "1" Then
  1610.                     If CarryBit = 0 Then
  1611.                         Bit4 = 0
  1612.                         CarryBit = 1
  1613.                     ElseIf CarryBit = 1 Then
  1614.                         Bit4 = 1
  1615.                         CarryBit = 1
  1616.                     End If
  1617.                 End If
  1618.                 If BinaryStr(2) = "0" And BinaryStr6(2) = "0" Then
  1619.                     If CarryBit = 0 Then
  1620.                         Bit3 = 0
  1621.                     ElseIf CarryBit = 1 Then
  1622.                         Bit3 = 1
  1623.                         CarryBit = 0
  1624.                     End If
  1625.                 ElseIf BinaryStr(2) = "1" And BinaryStr6(2) = "0" Then
  1626.                     If CarryBit = 0 Then
  1627.                         Bit3 = 1
  1628.                     ElseIf CarryBit = 1 Then
  1629.                         Bit3 = 0
  1630.                         CarryBit = 1
  1631.                     End If
  1632.                 ElseIf BinaryStr(2) = "0" And BinaryStr6(2) = "1" Then
  1633.                     If CarryBit = 0 Then
  1634.                         Bit3 = 1
  1635.                     ElseIf CarryBit = 1 Then
  1636.                         Bit3 = 0
  1637.                         CarryBit = 1
  1638.                     End If
  1639.                 ElseIf BinaryStr(2) = "1" And BinaryStr6(2) = "1" Then
  1640.                     If CarryBit = 0 Then
  1641.                         Bit3 = 0
  1642.                         CarryBit = 1
  1643.                     ElseIf CarryBit = 1 Then
  1644.                         Bit3 = 1
  1645.                         CarryBit = 1
  1646.                     End If
  1647.                 End If
  1648.                 If BinaryStr(1) = "0" And BinaryStr6(1) = "0" Then
  1649.                     If CarryBit = 0 Then
  1650.                         Bit2 = 0
  1651.                     ElseIf CarryBit = 1 Then
  1652.                         Bit2 = 1
  1653.                         CarryBit = 0
  1654.                     End If
  1655.                 ElseIf BinaryStr(1) = "1" And BinaryStr6(1) = "0" Then
  1656.                     If CarryBit = 0 Then
  1657.                         Bit2 = 1
  1658.                     ElseIf CarryBit = 1 Then
  1659.                         Bit2 = 0
  1660.                         CarryBit = 1
  1661.                     End If
  1662.                 ElseIf BinaryStr(1) = "0" And BinaryStr6(1) = "1" Then
  1663.                     If CarryBit = 0 Then
  1664.                         Bit2 = 1
  1665.                     ElseIf CarryBit = 1 Then
  1666.                         Bit2 = 0
  1667.                         CarryBit = 1
  1668.                     End If
  1669.                 ElseIf BinaryStr(1) = "1" And BinaryStr6(1) = "1" Then
  1670.                     If CarryBit = 0 Then
  1671.                         Bit2 = 0
  1672.                         CarryBit = 1
  1673.                     ElseIf CarryBit = 1 Then
  1674.                         Bit2 = 1
  1675.                         CarryBit = 1
  1676.                     End If
  1677.                 End If
  1678.                 If BinaryStr(0) = "0" And BinaryStr6(0) = "0" Then
  1679.                     If CarryBit = 0 Then
  1680.                         Bit1 = 0
  1681.                     ElseIf CarryBit = 1 Then
  1682.                         Bit1 = 1
  1683.                         CarryBit = 0
  1684.                     End If
  1685.                 ElseIf BinaryStr(0) = "1" And BinaryStr6(0) = "0" Then
  1686.                     If CarryBit = 0 Then
  1687.                         Bit1 = 1
  1688.                     ElseIf CarryBit = 1 Then
  1689.                         Bit1 = 0
  1690.                         CarryBit = 1
  1691.                     End If
  1692.                 ElseIf BinaryStr(0) = "0" And BinaryStr6(0) = "1" Then
  1693.                     If CarryBit = 0 Then
  1694.                         Bit1 = 1
  1695.                     ElseIf CarryBit = 1 Then
  1696.                         Bit1 = 0
  1697.                         CarryBit = 1
  1698.                     End If
  1699.                 ElseIf BinaryStr(0) = "1" And BinaryStr6(0) = "1" Then
  1700.                     If CarryBit = 0 Then
  1701.                         Bit1 = 0
  1702.                         CarryBit = 1
  1703.                     ElseIf CarryBit = 1 Then
  1704.                         Bit1 = 1
  1705.                         CarryBit = 1
  1706.                     End If
  1707.                 End If
  1708.                 BinaryStr5 = Bit1 & Bit2 & Bit3 & Bit4 & Bit5 & Bit6 & Bit7 & Bit8
  1709.                 OverallAnswer = BinaryStr5
  1710.             ElseIf QuestionType2 = 2 Then
  1711.                 If BinOrHex = 0 Then
  1712.                     If RandInteger >= 128 Then
  1713.                         BinaryStr += "1"
  1714.                         RandInteger -= 128
  1715.                     Else
  1716.                         BinaryStr += "0"
  1717.                     End If
  1718.                     If RandInteger >= 64 Then
  1719.                         BinaryStr += "1"
  1720.                         RandInteger -= 64
  1721.                     Else
  1722.                         BinaryStr += "0"
  1723.                     End If
  1724.                     If RandInteger >= 32 Then
  1725.                         BinaryStr += "1"
  1726.                         RandInteger -= 32
  1727.                     Else
  1728.                         BinaryStr += "0"
  1729.                     End If
  1730.                     If RandInteger >= 16 Then
  1731.                         BinaryStr += "1"
  1732.                         RandInteger -= 16
  1733.                     Else
  1734.                         BinaryStr += "0"
  1735.                     End If
  1736.                     If RandInteger >= 8 Then
  1737.                         BinaryStr += "1"
  1738.                         RandInteger -= 8
  1739.                     Else
  1740.                         BinaryStr += "0"
  1741.                     End If
  1742.                     If RandInteger >= 4 Then
  1743.                         BinaryStr += "1"
  1744.                         RandInteger -= 4
  1745.                     Else
  1746.                         BinaryStr += "0"
  1747.                     End If
  1748.                     If RandInteger >= 2 Then
  1749.                         BinaryStr += "1"
  1750.                         RandInteger -= 2
  1751.                     Else
  1752.                         BinaryStr += "0"
  1753.                     End If
  1754.                     If RandInteger >= 1 Then
  1755.                         BinaryStr += "1"
  1756.                         RandInteger -= 1
  1757.                     Else
  1758.                         BinaryStr += "0"
  1759.                     End If
  1760.                     OverallAnswer = BinaryStr
  1761.                 Else
  1762.                     OverallAnswer = "Error"
  1763.                 End If
  1764.             End If
  1765.         End If
  1766.         Return OverallAnswer
  1767.     End Function
  1768.  
  1769.     Public Function AnswerCheck()
  1770.  
  1771.         If Counter2 = False Then
  1772.             RichTextBox4.AppendText(Answers(HexOrDec, BinaryStr, DecAnswer, OverallAnswer, HexAnswer, QuestionType, BinaryStr2, SumNum1, SumNum2, UnroundedAnswer, BinOrHex, BinaryStr5))
  1773.             Counter2 = True
  1774.         End If
  1775.  
  1776.         If InputType = False Then
  1777.             If RichTextBox3.Text = RichTextBox4.Text Then
  1778.                 Return "Correct!"
  1779.             Else
  1780.                 Return "Incorrect. Try again"
  1781.             End If
  1782.         ElseIf InputType = True Then
  1783.             If BinaryStr3 = RichTextBox4.Text Then
  1784.                 Return "Correct!"
  1785.             Else
  1786.                 Return "Incorrect. Try again"
  1787.             End If
  1788.         Else
  1789.             Return "Error"
  1790.  
  1791.         End If
  1792.  
  1793.     End Function
  1794.  
  1795.     Private Sub Label24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label24.Click
  1796.  
  1797.         AnswerThing()
  1798.  
  1799.     End Sub
  1800.  
  1801.     Public Sub AnswerThing()
  1802.  
  1803.         If Counter > 2 Then
  1804.             Counter = 0
  1805.         End If
  1806.  
  1807.         RichTextBox5.Clear()
  1808.         RichTextBox5.AppendText(AnswerCheck())
  1809.         If RichTextBox5.Text = "Incorrect. Try again" Then
  1810.             Counter += 1
  1811.             If Counter > 2 Then
  1812.                 Label23.Visible = True
  1813.             End If
  1814.         ElseIf RichTextBox5.Text = "Correct!" Then
  1815.             If Counter3 = False Then
  1816.                 Score += 1
  1817.                 Label5.Text = Score
  1818.                 Counter3 = True
  1819.             End If
  1820.         End If
  1821.  
  1822.     End Sub
  1823.  
  1824.     Private Sub Label12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label12.Click
  1825.  
  1826.         If InputType = True Then
  1827.             InputType = False
  1828.             RichTextBox3.SelectionAlignment = HorizontalAlignment.Center
  1829.             Panel1.Visible = False
  1830.             RichTextBox2.Visible = False
  1831.             RichTextBox4.Visible = False
  1832.             RichTextBox5.Visible = False
  1833.             Label23.Visible = False
  1834.             Label24.Visible = False
  1835.         ElseIf InputType = False Then
  1836.             InputType = True
  1837.             RichTextBox3.Visible = False
  1838.             RichTextBox2.Visible = False
  1839.             RichTextBox4.Visible = False
  1840.             RichTextBox5.Visible = False
  1841.             Label23.Visible = False
  1842.             Label24.Visible = False
  1843.             CheckBox1.Visible = False
  1844.         End If
  1845.  
  1846.     End Sub
  1847.  
  1848.     Private Sub Label23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label23.Click
  1849.  
  1850.         RichTextBox4.Visible = True
  1851.  
  1852.         Counter3 = True
  1853.  
  1854.     End Sub
  1855.  
  1856.     Private Sub Label6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label6.Click
  1857.  
  1858.         Label24.Visible = True
  1859.         Label23.Visible = False
  1860.         RichTextBox2.Visible = True
  1861.         RichTextBox4.Visible = False
  1862.         RichTextBox5.Visible = True
  1863.         Panel2.Visible = True
  1864.         Label12.Visible = True
  1865.         CheckBox1.Visible = False
  1866.         Panel3.Visible = False
  1867.         TextBox1.Visible = False
  1868.         TextBox1.TextAlign = HorizontalAlignment.Center
  1869.  
  1870.         If InputType = True Then
  1871.             Panel1.Visible = True
  1872.         ElseIf InputType = False Then
  1873.             RichTextBox3.Visible = True
  1874.             CheckBox1.Visible = True
  1875.         End If
  1876.  
  1877.         RichTextBox2.Clear()
  1878.         RichTextBox3.Clear()
  1879.         RichTextBox4.Clear()
  1880.         RichTextBox5.Clear()
  1881.         Counter2 = False
  1882.         Counter3 = False
  1883.         BinaryStr = ""
  1884.         BinaryStr2 = ""
  1885.         BinaryStr5 = ""
  1886.         OverallAnswer = ""
  1887.  
  1888.         Questions(BinNum, HexOrDec, QType, BinaryStr, InputType)
  1889.  
  1890.     End Sub
  1891.  
  1892.     Private Sub lblTextSource3_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblTextSource3.MouseDown
  1893.         lblTextSource3.DoDragDrop(
  1894.             lblTextSource3.Text,
  1895.             DragDropEffects.Copy)
  1896.     End Sub
  1897.  
  1898.     Private Sub lblTextSource4_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblTextSource4.MouseDown
  1899.         lblTextSource4.DoDragDrop(
  1900.             lblTextSource4.Text,
  1901.             DragDropEffects.Copy)
  1902.     End Sub
  1903.  
  1904.     Private Sub lblTextTarget9_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget9.DragEnter
  1905.         If e.Data.GetDataPresent(DataFormats.Text) Then
  1906.             e.Effect = DragDropEffects.Copy
  1907.         Else
  1908.             e.Effect = DragDropEffects.None
  1909.         End If
  1910.     End Sub
  1911.  
  1912.     Private Sub lblTextTarget9_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget9.DragDrop
  1913.         lblTextTarget9.Text = e.Data.GetData(DataFormats.Text).ToString
  1914.     End Sub
  1915.  
  1916.     Private Sub lblTextTarget10_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget10.DragEnter
  1917.         If e.Data.GetDataPresent(DataFormats.Text) Then
  1918.             e.Effect = DragDropEffects.Copy
  1919.         Else
  1920.             e.Effect = DragDropEffects.None
  1921.         End If
  1922.     End Sub
  1923.  
  1924.     Private Sub lblTextTarget10_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget10.DragDrop
  1925.         lblTextTarget10.Text = e.Data.GetData(DataFormats.Text).ToString
  1926.     End Sub
  1927.  
  1928.     Private Sub lblTextTarget11_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget11.DragEnter
  1929.         If e.Data.GetDataPresent(DataFormats.Text) Then
  1930.             e.Effect = DragDropEffects.Copy
  1931.         Else
  1932.             e.Effect = DragDropEffects.None
  1933.         End If
  1934.     End Sub
  1935.  
  1936.     Private Sub lblTextTarget11_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget11.DragDrop
  1937.         lblTextTarget11.Text = e.Data.GetData(DataFormats.Text).ToString
  1938.     End Sub
  1939.  
  1940.     Private Sub lblTextTarget12_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget12.DragEnter
  1941.         If e.Data.GetDataPresent(DataFormats.Text) Then
  1942.             e.Effect = DragDropEffects.Copy
  1943.         Else
  1944.             e.Effect = DragDropEffects.None
  1945.         End If
  1946.     End Sub
  1947.  
  1948.     Private Sub lblTextTarget12_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget12.DragDrop
  1949.         lblTextTarget12.Text = e.Data.GetData(DataFormats.Text).ToString
  1950.     End Sub
  1951.  
  1952.     Private Sub lblTextTarget13_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget13.DragEnter
  1953.         If e.Data.GetDataPresent(DataFormats.Text) Then
  1954.             e.Effect = DragDropEffects.Copy
  1955.         Else
  1956.             e.Effect = DragDropEffects.None
  1957.         End If
  1958.     End Sub
  1959.  
  1960.     Private Sub lblTextTarget13_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget13.DragDrop
  1961.         lblTextTarget13.Text = e.Data.GetData(DataFormats.Text).ToString
  1962.     End Sub
  1963.  
  1964.     Private Sub lblTextTarget14_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget14.DragEnter
  1965.         If e.Data.GetDataPresent(DataFormats.Text) Then
  1966.             e.Effect = DragDropEffects.Copy
  1967.         Else
  1968.             e.Effect = DragDropEffects.None
  1969.         End If
  1970.     End Sub
  1971.  
  1972.     Private Sub lblTextTarget14_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget14.DragDrop
  1973.         lblTextTarget14.Text = e.Data.GetData(DataFormats.Text).ToString
  1974.     End Sub
  1975.  
  1976.     Private Sub lblTextTarget15_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget15.DragEnter
  1977.         If e.Data.GetDataPresent(DataFormats.Text) Then
  1978.             e.Effect = DragDropEffects.Copy
  1979.         Else
  1980.             e.Effect = DragDropEffects.None
  1981.         End If
  1982.     End Sub
  1983.  
  1984.     Private Sub lblTextTarget15_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget15.DragDrop
  1985.         lblTextTarget15.Text = e.Data.GetData(DataFormats.Text).ToString
  1986.     End Sub
  1987.  
  1988.     Private Sub lblTextTarget16_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget16.DragEnter
  1989.         If e.Data.GetDataPresent(DataFormats.Text) Then
  1990.             e.Effect = DragDropEffects.Copy
  1991.         Else
  1992.             e.Effect = DragDropEffects.None
  1993.         End If
  1994.     End Sub
  1995.  
  1996.     Private Sub lblTextTarget16_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lblTextTarget16.DragDrop
  1997.         lblTextTarget16.Text = e.Data.GetData(DataFormats.Text).ToString
  1998.     End Sub
  1999.  
  2000.     Private Sub BinarySet()
  2001.  
  2002.         Binary.Insert(0, lblTextTarget9.Text)
  2003.         Binary.Insert(1, lblTextTarget10.Text)
  2004.         Binary.Insert(2, lblTextTarget11.Text)
  2005.         Binary.Insert(3, lblTextTarget12.Text)
  2006.         Binary.Insert(4, lblTextTarget13.Text)
  2007.         Binary.Insert(5, lblTextTarget14.Text)
  2008.         Binary.Insert(6, lblTextTarget15.Text)
  2009.         Binary.Insert(7, lblTextTarget16.Text)
  2010.  
  2011.     End Sub
  2012.  
  2013.     Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
  2014.  
  2015.         If lblTextTarget9.Text <> "" Then
  2016.             RichTextBox1.AppendText(lblTextTarget9.Text)
  2017.             lblTextTarget9.Text = ""
  2018.         Else
  2019.             RichTextBox1.AppendText("0")
  2020.             lblTextTarget9.Text = ""
  2021.         End If
  2022.         If lblTextTarget10.Text <> "" Then
  2023.             RichTextBox1.AppendText(lblTextTarget10.Text)
  2024.             lblTextTarget10.Text = ""
  2025.         Else
  2026.             RichTextBox1.AppendText("0")
  2027.             lblTextTarget10.Text = ""
  2028.         End If
  2029.         If lblTextTarget11.Text <> "" Then
  2030.             RichTextBox1.AppendText(lblTextTarget11.Text)
  2031.             lblTextTarget11.Text = ""
  2032.         Else
  2033.             RichTextBox1.AppendText("0")
  2034.             lblTextTarget11.Text = ""
  2035.         End If
  2036.         If lblTextTarget12.Text <> "" Then
  2037.             RichTextBox1.AppendText(lblTextTarget12.Text)
  2038.             lblTextTarget12.Text = ""
  2039.         Else
  2040.             RichTextBox1.AppendText("0")
  2041.             lblTextTarget12.Text = ""
  2042.         End If
  2043.         If lblTextTarget13.Text <> "" Then
  2044.             RichTextBox1.AppendText(lblTextTarget13.Text)
  2045.             lblTextTarget13.Text = ""
  2046.         Else
  2047.             RichTextBox1.AppendText("0")
  2048.             lblTextTarget13.Text = ""
  2049.         End If
  2050.         If lblTextTarget14.Text <> "" Then
  2051.             RichTextBox1.AppendText(lblTextTarget14.Text)
  2052.             lblTextTarget14.Text = ""
  2053.         Else
  2054.             RichTextBox1.AppendText("0")
  2055.             lblTextTarget14.Text = ""
  2056.         End If
  2057.         If lblTextTarget15.Text <> "" Then
  2058.             RichTextBox1.AppendText(lblTextTarget15.Text)
  2059.             lblTextTarget15.Text = ""
  2060.         Else
  2061.             RichTextBox1.AppendText("0")
  2062.             lblTextTarget15.Text = ""
  2063.         End If
  2064.         If lblTextTarget16.Text <> "" Then
  2065.             RichTextBox1.AppendText(lblTextTarget16.Text)
  2066.             lblTextTarget16.Text = ""
  2067.         Else
  2068.             RichTextBox1.AppendText("0")
  2069.             lblTextTarget16.Text = ""
  2070.         End If
  2071.  
  2072.         BinaryLock(BinaryStr3, BinaryStr4, Counter)
  2073.  
  2074.         Label14.Text = BinaryStr3(0) & " " & BinaryStr3(1) & " " & BinaryStr3(2) & " " & BinaryStr3(3) & " " & BinaryStr3(4) & " " & BinaryStr3(5) & " " & BinaryStr3(6) & " " & BinaryStr3(7)
  2075.  
  2076.     End Sub
  2077.  
  2078.     Public Sub BinaryLock(ByRef BinaryStr3 As String, ByRef BinaryStr4 As String, ByRef Counter As Integer)
  2079.  
  2080.         BinaryStr3 = RichTextBox1.Text
  2081.         RichTextBox1.Clear()
  2082.  
  2083.     End Sub
  2084.  
  2085.     Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click
  2086.  
  2087.         Label3.Visible = False
  2088.         Label2.Visible = False
  2089.         Label6.Visible = True
  2090.         InputType = True
  2091.  
  2092.     End Sub
  2093.     Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click
  2094.  
  2095.         Label3.Visible = False
  2096.         Label2.Visible = False
  2097.         Label6.Visible = True
  2098.         InputType = False
  2099.         RichTextBox3.SelectionAlignment = HorizontalAlignment.Center
  2100.  
  2101.     End Sub
  2102.  
  2103.     Private Sub Label13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label13.Click
  2104.  
  2105.         End
  2106.  
  2107.     End Sub
  2108. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement