Solved

Convert a non printable ACSII char to a decimal value

Posted on 2009-07-14
2
389 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
Comment Utility
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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now