Question Format

horkesley

New member
Joined
Jul 28, 2011
Messages
2
Programming Experience
1-3
Hi,

I have the following, MakeCmd$ = "SY" & 0 & (size% + 1) & Data$ & chk%.

This creates SY0387142, this relates to, SY,0,3,87,142.

I want put this in a textbox in hex format.

I have tried various methods, such as 'CmdData1.Text = CmdData1.Text + Format(Hex$(Asc(Mid$(CmdStr$, Count%, 1))), "0#") + " " but
this does not work correctly.

Any hints were am going wrong would be appreciated.

Regards,
 
What are you after for your output? a string of hex values for each character in your source string? e.g 53# 59# ....?

If so, you can use the formatting available through .ToString(), with something like :

VB.NET:
hexString += (Asc(Mid$(testString, i, 1)).ToString("X")) & "# "

Is that what you're after?

Also denoting strings with a trailing $ is a bit old school ;)
 
Hi Menthos,

Thanks for the reply, code is now working fine.

Yes, I know about the trailing $, the code is very old and I have edited it to run under .NET.

Regards
 
Back
Top