|
-
Mar 20th, 2006, 06:53 PM
#1
Thread Starter
Member
[RESOLVED]Help me ;_; (reasonable question xD)
VB Code:
FileOpen(1, Mainform.OpenFileDialog1.FileName, OpenMode.Binary)
Dim pknameno As Integer = 386
Dim nameoff As Long = &H245EEC
Dim avec As Byte
Dim JJ As String
Dim doubled As Long
Dim lol As Integer = 12
For doubled = 0 To pknameno
Seek(1, nameoff + doubled)
FileGet(1, avec, nameoff + doubled)
JJ = ConvertByte(avec)
ComboBox1.Items.Add(JJ)
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.
-
Mar 20th, 2006, 06:56 PM
#2
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.
-
Mar 20th, 2006, 06:57 PM
#3
Thread Starter
Member
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
-
Mar 20th, 2006, 07:29 PM
#4
Re: Help me ;_; (reasonable question xD)
 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:
For doubled = 0 To pknameno [COLOR=Red]Step 12[/COLOR]
'*** Change this block to a loop that executes 12 times or a single statement that reads 12 bytes. ***
Seek(1, nameoff + doubled)
FileGet(1, avec, nameoff + doubled)
JJ = ConvertByte(avec)
'*** ***
'JJ will then contain 12 characters.
ComboBox1.Items.Add(JJ)
Next doubled
-
Mar 22nd, 2006, 12:23 PM
#5
Thread Starter
Member
Re: Help me ;_; (reasonable question xD)
cant bytes only store one letter though? and would i be able to use a for loop?
-
Mar 22nd, 2006, 12:41 PM
#6
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:
FileOpen(1, Mainform.OpenFileDialog1.FileName, OpenMode.Binary)
Dim pknameno As Integer = 386
Dim nameoff As Long = &H245EEC
Dim avec As Byte
Dim JJ As String
Dim cnt as integer
Dim doubled As Long
Dim lol As Integer = 12
For doubled = 0 To pknameno
Seek(1, nameoff + doubled)
FileGet(1, avec, nameoff + doubled)
JJ &= ConvertByte(avec)
cnt+=1
if cnt=12 then
ComboBox1.Items.Add(JJ)
cnt=0
jj=""
end if
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
 
-
Mar 22nd, 2006, 12:50 PM
#7
Thread Starter
Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|