Tamer_Ahmed Posted February 20, 2004 Posted February 20, 2004 hi every one in VB.net if we want to get the ASC for any char for example A we use this fuction Asc("A") what about C# i didn't find this Function here does anyone here can help Quote
Moderators Robby Posted February 20, 2004 Moderators Posted February 20, 2004 int myAsc = Convert.ToInt32(a); Quote Visit...Bassic Software
Tamer_Ahmed Posted February 20, 2004 Author Posted February 20, 2004 oops it's not working sorry robby for that i write the code like that int myAsc = Convert.ToInt32(A); MessageBox.Show(myAsc); there error called The name 'A' does not exist in the class or namespace 'ConsoleApplication1.Class1' well i tried to put it like that int myAsc = Convert.ToInt32("A"); here the error was Input string was not in a correct format. so do u have any advice for me Quote
*Experts* Bucky Posted February 20, 2004 *Experts* Posted February 20, 2004 You need to enclose the A in single quote marks to pass it as a Char type instead of as a String. int myAsc = Convert.ToInt32('A'); In VB.NET, this is accomplished with a trailing c after the quote marks: Dim myInt As Integer = Convert.ToInt32("A"c) Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
Tamer_Ahmed Posted February 20, 2004 Author Posted February 20, 2004 sorry this was stubid from me i must first Declare char char c = A; int myAsc = Convert.ToInt32(A); MessageBox.show(myAsc.Tostring()) Thankss again robby and sorry for buzzing u :D Quote
Moderators Robby Posted February 20, 2004 Moderators Posted February 20, 2004 Thanks Bucky. Quote Visit...Bassic Software
Tamer_Ahmed Posted February 20, 2004 Author Posted February 20, 2004 Thanks Bucky i sent my reply at the same time u were sending ur reply thanks :D Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.