Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 957
  • Last Modified:

How do I print ASCII 254 in VB.net

Hello

I  have a program where I need to insert ¦ into an editor. the ¦ is ascii 245 , if you open notepad and click alt+254 you get ¦
But I keep getting þ in vb when doing Convert.ToChar(254)
How can I get ¦ using vb.net
Thank you
0
xav056
Asked:
xav056
  • 6
  • 4
1 Solution
 
ladarlingCommented:

Chr(166)
0
 
xav056Author Commented:
nope that gives me ¦
And why is it that .tochar does not work like notepad
alt+166 gives ª

there is something i do not quite get in the ascii and unicode

http://www.killersites.com/webDesignersHandbook/ascii_page3.htm
0
 
MatrixDwellerCommented:
Wouldn't char(254) be logical?

If you want a null then vbNull works.
0
NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

 
ladarlingCommented:
If you are using a unicode based system, chr(166) should produce ¦
Unless you  are using a font that replaces that symbol?
TrueTypes are not supposed to do character substitution, but others will "Seriphs, etc"
0
 
ladarlingCommented:
Oh... And
ALT+166 is NOT the same as ALT+0166
Unicode is binary, and the 0 is significant. The VB.NET chr function uses the old ASCII code representation, which is chr(166)
 
0
 
xav056Author Commented:
yeah but I do not want to display  ¦, I want to display a black square
which in note pad is alt+254

but when I try convert.toChar(254) I get the equivalent of ALT+0254 in notepad

how can I get the black square?

Thank you
0
 
xav056Author Commented:
ladarling:
My appologies
It seems that the experts exchange site is messing up the chatracters now I see why you suggested 166.
Actually what I am looking for is a balck square
which you gget by typing in alt+254 in notepad

Thank you
0
 
ladarlingCommented:
Gotcha, lol
Try:

ChrW(9632)
The ChrW function lets you print from unicode extended....
0
 
xav056Author Commented:
K this looks promising
Can I know how did you come up with 9632?
How would I know how to replace whqat I see in note pad with vb?
Thank you
0
 
ladarlingCommented:
Sure,
The unicode character set is HUGE, and not all characters are assigned a keyboard shortcut (usually only common symbology and  the ones with a direct ASCII equivalent).
That black square is defined is ASCII as 254, but in unicode &HFE (254) is þ
So... open the handy dandy charmap, select the unicode version of the black block, and run AscW() on it in VB to find the code....
 
0
 
ladarlingCommented:
This will tell you the unicode ranges and subsets:
 http://www.ssec.wisc.edu/~tomw/java/unicode.html
 
0

Featured Post

Industry Leaders: 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!

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now