title: Binary - Decimal Converter VB
body: <p>I don't know what equation vb will recognise for my code. to work. The user chooses weather to enter a decimal number or binary. It will then use an equation to convert that number. I have started the decimal but then got stuck, with what equation to use. </p>
  
  <p>This is the code:</p>
  
  <pre><code>Module Module1
  
  Sub Main()
      Dim userchoice As String
      Dim numberchoice, numchoice, newnumber As Integer
      Console.WriteLine("Please choose weather to convert 1) decimal to Binary or 2)Binary to decimal.")
      userchoice = Console.ReadLine()
      If userchoice = 1 Then
          Console.WriteLine("You are converting from a Decimal - Binary")
          Console.WriteLine("Please enter the number,")
          numberchoice = Console.ReadLine()
      End If
      If numberchoice &gt; 128 Then
          Console.WriteLine("1")
          newnumber = numberchoice - 128
      End If
      If newnumber &gt; 64 Then
          Console.WriteLine("1")
          newnumber = newnumber - 64
      End If
      If numberchoice &gt; 32 Then
          Console.WriteLine("1")
          newnumber = newnumber - 32
      End If
      If numberchoice &gt; 16 Then
          Console.WriteLine("1")
          newnumber = newnumber - 16
      End If
      If numberchoice &gt; 8 Then
          Console.WriteLine("1")
          newnumber = newnumber - 8
      End If
      If numberchoice &gt; 4 Then
          Console.WriteLine("1")
          newnumber = newnumber - 4
      End If
      If numberchoice &gt; 2 Then
          Console.WriteLine("1")
          newnumber = newnumber - 2
      End If
      If numberchoice &gt; 1 Then
          Console.WriteLine("1")
          newnumber = newnumber - 1
      End If
      Console.ReadLine()
  
      If userchoice = 2 Then
          Console.WriteLine("You're converting from Binary - Decimal")
          Console.WriteLine("Please enter the binary number,")
          numchoice = Console.ReadLine()
      End If
  End Sub
  End Module
  </code></pre>