LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to express an ASCII number as the keystroke it represents?

Highlighted

Hello,

 

In one part of my program, I used a "key down" event structure and used as my output the ASCII representation of whichever key was pressed.  Now, I need to convert an ASCII number into the key it represents.

 

That is to say:  My input is an orange numeric; perhaps the number 65.  I want to convert that number 65 into the keyboard key it represents, which is a capital A.  From there, it would be nice if I could add that character to a string of text.

 

I searched and searched the forum but found nothing.  Surely if an event structure can convert a keystroke into an ASCII number, then I can do it in reverse?!

 

Thank you.

Message Edited by RaVNzCRoFT on 02-03-2010 03:36 PM
0 Kudos
Message 1 of 4
(924 Views)

Hi,

 

you could use an enum, which could be found here in the forum...

 

Do you know how to convert an enum to a string? (Hint: try the FormatIntoString function...)

Message Edited by GerdW on 02-03-2010 10:44 PM
Best regards,
GerdW
CLAD expired, using LV2011SP1 + LV2017 (+LV2019 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 2 of 4
(917 Views)
convertAscii.png
Message 3 of 4
(911 Views)
First I would change the type of your numeric input to be a unsigned 8-bit interger. Using a double doesn't make sense since you will never have fractional characters. Secondly, once you are using U8 values for your key values you can use an array of them which would effectively build your string. this array can easily be converted to a string using the primative "Byte Array to String".


Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 4 of 4
(908 Views)