Solved

Convert a non printable ACSII char to a decimal value

Posted on 2009-07-14
2
420 Views
Last Modified: 2012-05-07
THe routine below converts a string value of w to the ASCII equivalent of Dec 119, if i had a non printable character how could i convert it to a Dec?

For example the decimal value of 10
Public checksumchar As String = "w"
    Public Associatedchecksum(0) As String
 
 Private Sub Data_CheckSum()
        Dim myChars() As Char
        myChars = checksumchar.ToCharArray()
        Associatedchecksum(0) = AscW(myChars(0))
    End Sub

Open in new window

0
Comment
Question by:cmdolcet
  • 2
2 Comments
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 24853210
Yes I believe that works in most cases.  I know the line feed (nl) character does or at least it did for me.
Public checksumchar As String = vbLf
    Public Associatedchecksum(0) As String
 
 Private Sub Data_CheckSum()
        Dim myChars() As Char
        myChars = checksumchar.ToCharArray()
        Associatedchecksum(0) = AscW(myChars(0))
    End Sub

Open in new window

0
 
LVL 59

Accepted Solution

by:
Kevin Cross earned 500 total points
ID: 24853247
Here is an extended character that works, get 8226.  Note AscW works for unicode character set from 0 to  65535.

http://msdn.microsoft.com/en-us/library/zew1e4wc(VS.80).aspx
Public checksumchar As String = """
    Public Associatedchecksum(0) As String
 
 Private Sub Data_CheckSum()
        Dim myChars() As Char
        myChars = checksumchar.ToCharArray()
        Associatedchecksum(0) = AscW(myChars(0))
    End Sub

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question