title: vb.net read binary file
body: <p>This is what I use in VB5. How can I do the same thing in VB.net (2015)?</p>
  
  <p>With all the variables dimensioned the following VB5 code reads the first four bytes in a binary file opened as #2 to fill the li(4) array.</p>
  
  <pre><code>For i = 1 To 4
  mychar = InputB(1, #2) 'Get one character.
  li(i) = AscB(mychar)
  Next
  </code></pre>
  
  <p>Then I call my liconvert(a,b,c,d) function to get the long integer number
  represented by the first four bytes in the file and return that number as “t”</p>
  
  <pre><code>t = Val(liconvert(li(1), li(2), li(3), li(4)))
  </code></pre>
  
  <p>What I would do from here takes a lot more code. I just need to get this far.</p>