Home All Groups Group Topic Archive Search About

Playing card suits, vb.net?

Author
7 Apr 2006 8:09 AM
eejit
Another newbie question. I'm writing a program that reviews a text
file history of an online poker hand.

I'm using VB compact framework, for a pocket pc.

I'm trying to find a simple way to represent the suits of cards,
clubs, diamonds, spades, hearts, in a string. I thought for sure there
would be some sort of ASCII  symbol that I could just use in a string,
but I haven't found anything.

Is there a simple way to do this that I am missing?

Thanks for any help.

eejit

Author
7 Apr 2006 10:31 AM
Ken Tucker [MVP]
Hi,

        Maybe there is something the card game starter kit to help.

http://msdn.microsoft.com/vbasic/downloads/starterkits/default.aspx

Ken
----------------
Show quoteHide quote
"eejit" <ee***@canada.com> wrote in message
news:7g7c32hunt611l8875jlnj6bvidlsfr6vq@4ax.com...
> Another newbie question. I'm writing a program that reviews a text
> file history of an online poker hand.
>
> I'm using VB compact framework, for a pocket pc.
>
> I'm trying to find a simple way to represent the suits of cards,
> clubs, diamonds, spades, hearts, in a string. I thought for sure there
> would be some sort of ASCII  symbol that I could just use in a string,
> but I haven't found anything.
>
> Is there a simple way to do this that I am missing?
>
> Thanks for any help.
>
> eejit
Author
7 Apr 2006 11:32 AM
C-Services Holland b.v.
eejit wrote:
Show quoteHide quote
> Another newbie question. I'm writing a program that reviews a text
> file history of an online poker hand.
>
> I'm using VB compact framework, for a pocket pc.
>
> I'm trying to find a simple way to represent the suits of cards,
> clubs, diamonds, spades, hearts, in a string. I thought for sure there
> would be some sort of ASCII  symbol that I could just use in a string,
> but I haven't found anything.
>
> Is there a simple way to do this that I am missing?
>
> Thanks for any help.
>
> eejit

The suits are in the Arial font. Open up charmap (start->run->charmap)
and you'll see them if you scroll down (U+2660 it tells me in the status
line of charmap).


--
Rinze van Huizen
C-Services Holland b.v
Author
7 Apr 2006 1:39 PM
AMercer
> > I'm trying to find a simple way to represent the suits of cards,
> > clubs, diamonds, spades, hearts, in a string. I thought for sure there
> > would be some sort of ASCII  symbol that I could just use in a string,
> > but I haven't found anything.

Public Const chSpade As Char = ChrW(9824)
Public Const chHeart As Char = ChrW(9829)
Public Const chDiamond As Char = ChrW(9830)
Public Const chClub As Char = ChrW(9827)

Use these just like any other string, eg "A" & chSpade gives "Aâ™ ".  These
are the correct values, but not all fonts cooperate.

This is unicode, not ascii, where a character in a string is 16 bits (not
8).  Unicode is the default for basic, so you don't have to do anything
special to call ChrW() with big numbers.

If you need to print, your printer may not be capable of representing these
characters, so you may need a fallback, maybe s,h,d,c.  '8s 8c As Jd 2h'
doesn't look too bad.
Author
8 Apr 2006 5:20 AM
eejit
On Fri, 7 Apr 2006 06:39:01 -0700, AMercer
<AMer***@discussions.microsoft.com> wrote:

Show quoteHide quote
>> > I'm trying to find a simple way to represent the suits of cards,
>> > clubs, diamonds, spades, hearts, in a string. I thought for sure there
>> > would be some sort of ASCII  symbol that I could just use in a string,
>> > but I haven't found anything.
>
>Public Const chSpade As Char = ChrW(9824)
>Public Const chHeart As Char = ChrW(9829)
>Public Const chDiamond As Char = ChrW(9830)
>Public Const chClub As Char = ChrW(9827)
>
>Use these just like any other string, eg "A" & chSpade gives "A?".  These
>are the correct values, but not all fonts cooperate.
>
>This is unicode, not ascii, where a character in a string is 16 bits (not
>8).  Unicode is the default for basic, so you don't have to do anything
>special to call ChrW() with big numbers.
>
>If you need to print, your printer may not be capable of representing these
>characters, so you may need a fallback, maybe s,h,d,c.  '8s 8c As Jd 2h'
>doesn't look too bad.


Thanks to everyone for taking the time to reply.

I decided to go with the arial font chrw(9824) method. I tested it out
in vb and it works, but for some reason when I try it using the
compact framework, arial font, instead of the playing card suit, I get
a square. So I'm not quite sure what is going on here.

thanks again for the help.

eejit