Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do I print ASCII 254 in VB.net

Posted on 2010-08-16
11
Medium Priority
?
943 Views
Last Modified: 2013-11-08
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
Comment
Question by:xav056
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
11 Comments
 
LVL 11

Expert Comment

by:ladarling
ID: 33449302

Chr(166)
0
 
LVL 9

Author Comment

by:xav056
ID: 33449362
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
 
LVL 2

Expert Comment

by:MatrixDweller
ID: 33449564
Wouldn't char(254) be logical?

If you want a null then vbNull works.
0
Quick Start: DOCKER

Sometimes you just need a Quick Start on a topic in order to begin using it.. this is just what you need to know to get up and running with Docker!

 
LVL 11

Expert Comment

by:ladarling
ID: 33449670
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
 
LVL 11

Expert Comment

by:ladarling
ID: 33449697
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
 
LVL 9

Author Comment

by:xav056
ID: 33449732
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
 
LVL 9

Author Comment

by:xav056
ID: 33449749
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
 
LVL 11

Expert Comment

by:ladarling
ID: 33449822
Gotcha, lol
Try:

ChrW(9632)
The ChrW function lets you print from unicode extended....
0
 
LVL 9

Author Comment

by:xav056
ID: 33449943
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
 
LVL 11

Expert Comment

by:ladarling
ID: 33450176
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
 
LVL 11

Accepted Solution

by:
ladarling earned 2000 total points
ID: 33450196
This will tell you the unicode ranges and subsets:
 http://www.ssec.wisc.edu/~tomw/java/unicode.html
 
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

715 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