|
|
| View previous topic :: View next topic |
| Message |
|
Author
|
Jon Turlington
Newbie
|
Joined: 07 Jul 2006
Posts: 2
|
|
Posted: Fri Jul 07, 2006 1:00 am
Post subject: Enum Letters On Phone KeyPad And Convert |
|
|
Here is what I have but it's definately not working.
I am trying to have a text box with letters in it and if someone where to try entering a word from a phone keypad and it came out as numbers what those numbers would be.
Here's my failing attempt but maybe some one can steer my ship in the right direction:
<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.ComponentModel" %>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
http://www.w3.org/1999/xhtml" >
Untitled Page
|
| Back to top |
|
 |
|
Author
|
Jon Turlington
Newbie
|
Joined: 07 Jul 2006
Posts: 2
|
|
Posted: Fri Jul 07, 2006 4:00 am
Post subject: |
|
|
Here is what I have but it's definately not working.
I am trying to have a text box with letters in it and if someone where to try entering a word from a phone keypad and it came out as numbers what those numbers would be.
Here's my failing attempt but maybe some one can steer my ship in the right direction:
<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.ComponentModel" %>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
http://www.w3.org/1999/xhtml" >
Untitled Page
|
| Back to top |
|
 |
|
Author
|
Cerebrus
Intermediate
|
Joined: 03 Jul 2006
Posts: 342
|
|
Posted: Sun Jul 16, 2006 1:00 pm
Post subject: |
|
|
Simple :
In your Button Click event, change the For Each loop to :
-------------------
For Each Chr In TextBox1.Text
Label1.Text += CStr([Enum].Parse(GetType(Phone), Chr.ToString(),
True))
Next
-------------------
What we're basically doing here, is supplying the string representation of the Enum and we want to get the numeric constant associated with it.
The Parse method allows us to do that. Note that if an space is entered in the text, your program will give an exception. You can decide how to handle this. (Maybe you could substitute a 0 for spaces...)
HTH,
Regards,
Cerebrus.
|
| Back to top |
|
 |
|
Author
|
JonTurlington
Newbie
|
Joined: 19 Jul 2006
Posts: 5
|
|
Posted: Wed Jul 19, 2006 1:00 am
Post subject: |
|
|
Thanks alot for the help!
I post things on the boards and they always seem ignored.
Jon
|
| Back to top |
|
 |
|
Author
|
Cerebrus
Intermediate
|
Joined: 03 Jul 2006
Posts: 342
|
|
Posted: Thu Jul 20, 2006 1:00 am
Post subject: |
|
|
Well, some newsgroups have less activity, and some have so much activity, that it's difficult to keep up.
I monitor a lot of groups including this one, but I'm usually found posting in <http://groups.google.com/group/DotNetDevelopment>
Have a nice one,
Regards,
Cerebrus.
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|