title: Binary Converter to Decimal with .NET
body: <p>I'm started to get the hang of some programming basics but I'm still very new and inexperienced. I am having trouble with a new program I am coding.</p>
  
  <p>I want to have a program in which an 8-bit binary number is put in a textbox, a button is pressed, and the decimal value of the binary number is shown.</p>
  
  <p>Below is the code i have tried:</p>
  
  <pre><code>Public Class Form1
  
  Private Sub btnConvert_Click(sender As Object, e As EventArgs) Handles btnConvert.Click
  
      Dim N As Integer
      N = Convert.ToDouble(tbxBin.Text)
      N = N Mod 2
      N = N \ 2
      lblAns.Text = Convert.ToString(N)
  
  End Sub
  End Class
  </code></pre>
  
  <p>Sadly, when I run the program I only get a decimal number of 0 no matter what binary code I put in. I'm very confused because I was told the use Mod class. When I look online for a solution to my problem, I see techniques and various coding processes I've never seen before. </p>
  
  <p>Apparently with my code, I have to repeat what I typed for as many bits as the user is typing in, however, I'm confused as to how I go about that. Do I Dim new variables?</p>
  
  <p>Any and all help is greatly appreciated. Thank you.</p>