Put, Get File Stream Stuff

that doesnt help at all....I cant find anything on the new functions that replaced Get and Put in vb6...
 
Sorry... I gived you the C# reference (my fault)

This link will explain you how to do a transition between VB6 and VB.NET : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvbpj01/html/gs0601.asp

Here is an exemple of a Integer Property :
Code:
[size=2][color=#0000ff]Public[/color][/size][size=2][color=#0000ff]Property[/color][/size][size=2] Test() [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]Integer[/color][/size]
[size=2][color=#0000ff]Get[/color][/size]
[color=#0000ff]..... something here to retrieve the value[/color]
[size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]Get[/color][/size]
[size=2][color=#0000ff]Set[/color][/size][size=2]([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] Value [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]Integer[/color][/size][size=2])[/size]
..... Something here to set the value received
[size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]Set[/color][/size]
[size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]Property[/color][/size]

....
As an addition Im working with C# and theres a wizard to build property, method, field, indexor... I must admit that VS.NET is lacking "user-friendly" tool for VB.NET user (which should be a big majority of all .NET programmer)
 
thats better, Thanks, but how would that work with getting a hex value, i know in vb6 it was:
Get #1, &H4DA + 1, variable
and i used put like this
Put #1, &H4DA + 1, CInt(Val(variable))
and they worked fine...but I dont see how it would work with the way you showed me in your post...

what im trying to do is make a program that edits a certain thing, so you can change values, and text in the program....I know how todo everything, except the get and put stuff...

Thanks in advance
 
If you are wanting to read and write to files then you would use something like:
Code:
        Dim fs As New System.IO.FileStream("c:\test.txt", IO.FileMode.Open)
        Dim b As Byte
        b = fs.ReadByte()  to read a single byte
        Dim data() As Byte
        fs.Read(data, 0, 100)   read 100 bytes.

        fs.Write(data, 0, 100) write an array of 100 bytes
        fs.WriteByte(1)         write a single byte

although you may want to look at serialization if you are saving things to your own file format - takes a lot of the work out of it.
 
excellent, exactly what I wanted....naw, I dont need serialization, im saving changes to the file that already exists....thanks
 
arent StreamReader and BinaryReader the suggested method for interfacing streams????

Its an adapter that makes it simple to get data between streams and data structures. You never have to interface the stream.


look up writing binary data and Writing Text to a File in the Help Index
 
dcahrakos said:
well really its not binary im looking for its always Hex....
Everything is binary.

You want binary reader for everything that isnt to be interpreted as Text.

Hex is just a manner of representing an integer - a binary piece of data.
I could represent it as Oct, its still a binary piece of data.

Use the BinaryReader.
 
Back
Top