# Converting string to hex in VB express



## darksteel88 (Jul 10, 2008)

So I'm trying to read in a specific file type (.pkm), which is translating to ASCII code normally (expected). I want to convert that ASCII code into hex. However, every attempt I have tried has failed, I often got a message saying I could not convert it to type long.


```
Dim file As String
        Dim data1 As String

        file = "D:\Documents and Settings\owner\Desktop\Pokemon\7-10-08_10ANNIV_ENG_Lugia.pkm"

        FileOpen(1, file, OpenMode.Binary)

        Do While Not EOF(1)
            Input(1, data1)
            Console.WriteLine(data1)
        Loop

        Console.ReadLine()
```
The Do While Not loop is fairly useless because I confirmed that it is all read in as a single string, and it is two lines long. I tried putting Hex(data1) above the writeline but I get the cannot convert to long error. Any help is appreciated.


----------



## deleted122510 (Mar 18, 2009)

Ha, useful idea.

I've worked with PKM files back in Diamond days, it's very interesting to debug them and see what's actually there. Although, I've never tried it in hex, Good Luck!!


----------



## darksteel88 (Jul 10, 2008)

Haha glad to see I'm not the only one. Ya, I collect events and I'm pretty well known, and we check to see if they were hacked with pokesav or not.

I have a friend that made a program to search the hex, was simplistic, but it worked. He used Delphi though. Mine would be rather more complex, a friend of mine has a chart that tells what all the hex are. However, I still need to view the hex, and I'm not sure exactly how, which is why I'm here waiting for an answer.


----------



## deleted122510 (Mar 18, 2009)

Hi - 

Yes! I really loved that program that checked the legitimacy of a Pokemon, it was truly useful for EV training and IV breeding to check if they were fakes when trading. Pokesav is neat, but cheap.

If you're looking for a program that will convert your file into hex, you could always just try another program and ditch trying to actually make one (so you have more options, resources, tech support, etc).

I recommend this[1] because it's both free and cool. I'm NOT entirely sure if it will convert your file (.pkm) to hex though, I'll test that all out later, but for now.. give it a shot.

[1] http://www.hhdsoftware.com/Products/home/hex-editor-free.html

Regards.


----------



## darksteel88 (Jul 10, 2008)

Cool, I'll try tomorrow (as in when I wake up today).

Ya, it's more complicated than just stats though. It includes checking pal park data (if it actually came from a GBA cart), WC data (if the wonder card was not in the original game), etc. As I stated, my friend drew up a list of what all the hex values corresponded to. I could develop a program to search through and return values, and then determine if they are correct.

And the reason I want to use VB express is because it is the only one I am fluent with, and it will be complicated as well as a form.


----------



## deleted122510 (Mar 18, 2009)

Yeah, I was thnking of making a PokeDex, a very very complex one for all 490 something Pokemon using VB.


----------



## darksteel88 (Jul 10, 2008)

All 493, but why when there are great online resources for things like that?


----------



## deleted122510 (Mar 18, 2009)

What happens when they're offline? 

And.. I'm bored.

So, did you solve your issue or..


----------



## darksteel88 (Jul 10, 2008)

Sorry, I've been a little busy with school for the last 2 weeks, just got off a few days ago.

Look, I already have Hex Editor Neo, and yes, it does work. But it doesn't cut it for what I want to do. I want it to compare certain strings to see if they are what they are supposed to do. It works as a VIEWER, but I can't program it to do other things.

What I need is an actual solution to read in the file using VB Express. I can get as far as to read it in as ASCII but not convert it.


----------



## deleted122510 (Mar 18, 2009)

Ah, you should probably take this to VBForums (.com), since they're very experienced and will help you.


----------



## darksteel88 (Jul 10, 2008)

Actually, I did, and I did get someone to answer it. I haven't had a chance to try it, but I will and it looks like it will work.


----------

