Groups | Blog | Home
all groups > vb.net > june 2007 >

vb.net : Decoding a password


Spam Catcher
6/6/2007 3:36:26 PM
"Diego F." <diego_frNO@msn.com> wrote in
news:O$4TA9EqHHA.1240@TK2MSFTNGP04.phx.gbl:

[quoted text, click to view]

Diego F.
6/6/2007 5:27:01 PM
Hi all.

I'm using a VB6 function in my .NET application that decodes a digit
sequence and should result in a word. The funcion uses Chr function, and I
finally get an illegible string (square symbols).

How can I convert that to letters, so I can retrieve the original password?

--

Regards,

Diego F.


Diego F.
6/6/2007 5:46:12 PM
I found that the problem is the use of Format function.

In VB6, that: Format("079", "000"), returns "079". But, in VB.NET, it
returns "000".

So, I'm getting different codes and the final conversion is different.

Any idea to solve that?

--

Regards,

Diego F.


[quoted text, click to view]

Diego F.
6/6/2007 6:02:31 PM
Ok, don't ask me how many format functions there are. I put String.Format,
and now it returns the expceted value :-)

--

Regards,

Diego F.


[quoted text, click to view]

Phill W.
6/7/2007 1:29:40 PM
[quoted text, click to view]

That's because "0" is not a valid formatting character when working with
a /String/ value (IIRC, "@" is the only one).

You must convert your value to a /numeric/ type before calling Format on
it, as in:

Format( CInt( "079" ), "000" )

HTH,
AddThis Social Bookmark Button