Results 1 to 5 of 5

Thread: Put statement in VB.NET

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Location
    california
    Posts
    245

    Put statement in VB.NET

    Hello,

    I'm trying to learn VB.NET after learning VB6. I have a small program that uses Put to write variables to a file.

    I've learned about StreamWriter and BinaryWriter in VB.NET but am seemingly unable to write variants to a file using these (the way I did with Put). Is there any way to do this in VB.Net?

    Thanks for any help.

    - Jake

  2. #2
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    first of all instead of variant u use the object in .net..to convert an object to string you can do yourVar.ToString()

    hope this helps
    \m/\m/

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Location
    california
    Posts
    245
    thanks for the advice.

    here's the situation, you tell me if your idea should work:

    I have a byte array with values over 256. I can't write those using the binary writer because it doesn't like those bytes that are over 256.

    Here's the code that creates the bytes over 256:

    Code:
            For K = 0 To ((sArrayLength - rasSt) - 100)
                Bt1 = sRas(K) And &HF
                Bt2 = (sRas(K) And &HF0) \ 16
                tRas(K) = Bt2 Or (Bt1 * 256)
            Next K
    tRas is a byte array but it ends up containing bytes with values like 717 "2CD".

    Thanks for any more help..

    - J

  4. #4
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    A byte can only hold 256 different values. 2 ^ 8 =256. Each element of a byte array therefore could only hold a value between 0 and 255.

    What you're describing seems implausible.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Location
    california
    Posts
    245
    I agree completely, I couldn't believe my own eyes.

    Anyway I found a workaround.

    - J

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width