Results 1 to 7 of 7

Thread: [RESOLVED]Help me ;_; (reasonable question xD)

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    38

    [RESOLVED]Help me ;_; (reasonable question xD)

    VB Code:
    1. FileOpen(1, Mainform.OpenFileDialog1.FileName, OpenMode.Binary)
    2.                 Dim pknameno As Integer = 386
    3.                 Dim nameoff As Long = &H245EEC
    4.                 Dim avec As Byte
    5.                 Dim JJ As String
    6.                 Dim doubled As Long
    7.                 Dim lol As Integer = 12
    8.                 For doubled = 0 To pknameno
    9.                     Seek(1, nameoff + doubled)
    10.                     FileGet(1, avec, nameoff + doubled)
    11.                     JJ = ConvertByte(avec)
    12.                     ComboBox1.Items.Add(JJ)
    13.                 Next doubled

    theres the code... now what i need... is someone to make it so that it makes it display 12 letters on each combo box line instead of displaying one letter on each line... thanx in advance

    --Shaneypoo17
    Last edited by Shaneypoo17; Mar 22nd, 2006 at 01:09 PM.

  2. #2
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: Help me ;_; (reasonable question xD)

    Sounds like a homework assignment. We're not just going to do the programming for you. If you want that, chek out RentACoder or Guru.

    We'd be glad to help but you have to ask a question first and show us what you have attempted so far.
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    38

    Re: Help me ;_; (reasonable question xD)

    ;_; all i need.... is someone to tweak that a teensy bit so it shows 12 letters on each line instead of one O.o

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Help me ;_; (reasonable question xD)

    Quote Originally Posted by Shaneypoo17
    ;_; all i need.... is someone to tweak that a teensy bit so it shows 12 letters on each line instead of one O.o
    All you need is for someone to help you do it yourself. If you're reading text then you should be using a StreamReader. If your teacher has told you to do it this way then they need to brush up on their VB.NET as that looks like it's straight out of a VB6 program. Anyway, if you must continue in that fashion then instead of reading a single byte at a time you should be reading twelve, either in one go or in another loop inside your current loop. Once you have twelve characters then you add them to the ComboBox. You would make your For loop step 12 at a time instead of 1 and then read 12 bytes on each iteration.
    VB Code:
    1. For doubled = 0 To pknameno [COLOR=Red]Step 12[/COLOR]
    2.                     '*** Change this block to a loop that executes 12 times or a single statement that reads 12 bytes. ***
    3.                     Seek(1, nameoff + doubled)
    4.                     FileGet(1, avec, nameoff + doubled)
    5.                     JJ = ConvertByte(avec)
    6.                     '*** ***
    7.  
    8.                     'JJ will then contain 12 characters.
    9.                     ComboBox1.Items.Add(JJ)
    10.                 Next doubled
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    38

    Re: Help me ;_; (reasonable question xD)

    cant bytes only store one letter though? and would i be able to use a for loop?

  6. #6
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: Help me ;_; (reasonable question xD)

    Yes, bytes only store one character. I'm not entirely familiar with FileGet, and can't look it up at the moment. If you can pass a string, that would be ideal, but I don't think the ConvertByte function would work on a string, an alternative would be:

    VB Code:
    1. FileOpen(1, Mainform.OpenFileDialog1.FileName, OpenMode.Binary)
    2.                 Dim pknameno As Integer = 386
    3.                 Dim nameoff As Long = &H245EEC
    4.                 Dim avec As Byte
    5.                 Dim JJ As String
    6.                 Dim cnt as integer
    7.                 Dim doubled As Long
    8.                 Dim lol As Integer = 12
    9.                 For doubled = 0 To pknameno
    10.                     Seek(1, nameoff + doubled)
    11.                     FileGet(1, avec, nameoff + doubled)
    12.                     JJ &= ConvertByte(avec)
    13.                     cnt+=1
    14.                     if cnt=12 then
    15.                      ComboBox1.Items.Add(JJ)
    16.                      cnt=0
    17.                      jj=""
    18.                    end if    
    19.                 Next doubled

    Something like that should be close. Not all that efficient or anything, but it should do.

    Now, why are you using Longs? That looks like a VB6 holdover. A long in .NET holds 64bits, which is not terribly efficient on a 32 bit processor. The cost isn't really an issue, but why use it if you don't need to.
    My usual boring signature: Nothing

  7. #7

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    38

    Re: Help me ;_; (reasonable question xD)

    thanks dude, my problem is now solved... YAY!!!!

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