Jump to content
Xtreme .Net Talk

Recommended Posts

  • Administrators
Posted

Although the functions still exist you really should use the newer .Net methods. Look at the classes un System.IO for a starting point and also search MSDN for serialization.

If you have a particular problem / question post the relevant code etc and we'll see what we can do.

 

You may find http://www.xtremedotnettalk.com/showthread.php?t=39585 useful as well.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

"If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown

"Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me

"A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend.

C# TO VB TRANSLATOR

Posted

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 :

[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 I'm working with C# and there's 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)

"If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown

"Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me

"A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend.

C# TO VB TRANSLATOR

Posted

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

  • Administrators
Posted

If you are wanting to read and write to files then you would use something like:

       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.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

aren't 'StreamReader' and 'BinaryReader' the suggested method for interfacing streams????

 

It's 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

Joe Mamma

Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.

Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.

Posted
well really its not binary im looking for its always Hex....

Everything is binary.

 

You want binary reader for everything that isn't 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.

Joe Mamma

Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.

Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...