Viewing Hex in a ML TextBox

Discussion in 'Questions (Windows Mobile)' started by Zenerdiode, Oct 9, 2008.

  1. Zenerdiode

    Zenerdiode Active Member Licensed User

    Please be critical of the attached code. I'm wanting to analyse data telegrams by looking at the individual bytes - so this is the hex viewer of my work in progress. You see I take the string, work out how long it is and build each line of a Multiline TextBox.

    Is this the best way to deal with this? The text box is like having a 'Single Document Interface' type form, but I've never known the correct way to deal with them. I mean, say the IDE for Basic4PPC. Its not one long string being displayed in a textbox - or is it? I even thought about having a large table, with the hex and characters in individual cells but then I'm not that sure how to scroll it. It would help if I needed to modify some bytes (but at the moment I only need a viewer)

    Then the code to provide a hex representation of the bytes. Have I overlooked a library that may be able to handle it better than my attempt?

    Its working for what I want it to do but my eutopia would be to set byte sequences and have them displayed in a different colour. Would I have to do that in HTML?

    Requires FormLib.dll

    Attached Files:

  2. agraham

    agraham Expert Licensed User

    Effectively yes.

    My BytesConverter library will do it but your way is good enough. You should note however that Asc() can return values of higher than 256 as characters are 16 bit Unicode characters in B4ppc strings. However it's OK for testing but your final code may need to read the bytes from the file into a byte array using BinaryFile.ReadBytes to avoid the transformation into 16 bit characters.

    On the desktop you could use my RichTextDesktop library, on the device it would have to be HTML and my WebBrowser library.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice