-
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
-
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
-
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
-
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.
-
I agree completely, I couldn't believe my own eyes.
Anyway I found a workaround.
- J