Results 1 to 9 of 9

Thread: need help with read bytes

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2009
    Posts
    54

    need help with read bytes

    hello guys, please help me if u can


    i have a file with 48 bytes ..

    I want to read this 48 bytes this way:

    TextBox 1 = byte 1 to 12 of 48
    TextBox 2 = byte 13 to 24 of 48
    TextBox 3 = byte 25 to 48 of 48


    Can some1 help me?

  2. #2
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Re: need help with read bytes

    Code:
    text1.text = left(data,12)
    text2.text = mid(data,13,12)
    text3.text = right(data,24)
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2009
    Posts
    54

    Re: need help with read bytes

    I dont understand .. can you explain ?

  4. #4
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Re: need help with read bytes

    If you haven't loaded the data in first then you'd have to do that, but the 3 lines assume you have and it splits the data up...I'll reply in a second with a version that also loads the file in
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  5. #5
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Re: need help with read bytes

    Code:
    dim data as string, fre as double
    fre=freefile
    open "filename" for input as #fre
    input #fre, data
    close #fre
    text1.text = left(data,12)
    text2.text = mid(data,13,12)
    text3.text = right(data,24)
    Bear in mind that this was written on the forum and not in VB...it'll be reformatted a little in VB :-)
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  6. #6

    Thread Starter
    Member
    Join Date
    Oct 2009
    Posts
    54

    Re: need help with read bytes

    pay atention please..

    my 6 first bytes on file is:

    4D 5A 90 00 03 00 = MZ....

    When I open the file, i open in BINARY ACCESS, i want to read as HEX the first 6 bytes understand?

  7. #7
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Re: need help with read bytes

    Your first post had none of this info, and given the attitude you seem to be giving me for not knowing these facts you hadn't mentioned I will give up trying to help you from now on. Good luck getting help with your problem, I am sure there are umpteen other things you forgot to mention which will make anyone else's suggestions moot.
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  8. #8

    Thread Starter
    Member
    Join Date
    Oct 2009
    Posts
    54

    Re: need help with read bytes

    i am really sorry, i did not know how to explain myself .

  9. #9
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: need help with read bytes

    Quote Originally Posted by TheMarKs View Post
    pay atention please..

    my 6 first bytes on file is:

    4D 5A 90 00 03 00 = MZ....

    When I open the file, i open in BINARY ACCESS, i want to read as HEX the first 6 bytes understand?
    Well if your file actually has the Hex code as you described (assuming no spaces between them), the first 6 bytes are really 12 bytes. Each character is one byte. Do you know how to open and read text files? If not, suggest reading this FAQ first.

    P.S. Part of the frustration described by smUX can be avoided in the future. Give accurate details of your scenario, including real data and real code, not psuedo data/code.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

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