初学~搞了1天了~关于将textbox中的文字转换为ACSII码!高手麻烦给个例子!编译成功就马上给分!
就是从textbox里面输入的文字转换为ASCII码!或者是将一个数组里面的中文转换为ASCII码!编译成功马上给分!
------解决方案--------------------关于ASCII和字符的转换,你看看下面这段代码。     
 using System; 
 using System.Text;   
 namespace Encoding_Examples 
 { 
     using System; 
     using System.Text;   
     class EncodingExample  
     { 
         public static void Main()  
         { 
             // Create an ASCII encoding. 
             Encoding ascii = Encoding.ASCII;           
             // A Unicode string with two characters outside the ASCII code range. 
             String unicodeString = 
                  "This unicode string contains two characters  " + 
                  "with codes outside the ASCII code range,  " + 
                  "Pi (\u03a0) and Sigma (\u03a3). "; 
             Console.WriteLine( "Original string: "); 
             Console.WriteLine(unicodeString);   
             // Save the positions of the special characters for later reference. 
             int indexOfPi = unicodeString.IndexOf( '\u03a0 '); 
             int indexOfSigma = unicodeString.IndexOf( '\u03a3 ');   
             // Encode the string. 
             Byte[] encodedBytes = ascii.GetBytes(unicodeString); 
             Console.WriteLine(); 
             Console.WriteLine( "Encoded bytes: "); 
             foreach (Byte b in encodedBytes)  
             { 
                 Console.Write( "[{0}] ", b); 
             } 
             Console.WriteLine();           
             // Notice that the special characters have been replaced with 
             // the value 63, which is the ASCII character code for  '? '. 
             Console.WriteLine(); 
             Console.WriteLine( 
                  "Value at position of Pi character: {0} ", 
                 encodedBytes[indexOfPi] 
                 ); 
             Console.WriteLine( 
                  "Value at position of Sigma character: {0} ", 
                 encodedBytes[indexOfSigma] 
                 );   
             // Decode bytes back to a string. 
             // Notice missing the Pi and Sigma characters. 
             String decodedString = ascii.GetString(encodedBytes); 
             Console.WriteLine(); 
             Console.WriteLine( "Decoded bytes: "); 
             Console.WriteLine(decodedString); 
         } 
     } 
 }   
------解决方案--------------------string s =  " "; 
 foreach (byte vByte in Encoding.Default.GetBytes(textBox1.Text)) 
     s +=  "% " + vByte.ToString( "X2 "); 
 Text = s; 
------解决方案--------------------for   (int   i=0;   i    <  textbox1.Len;   i++)    
   {    
   int b   =   (char)(textbox1.text.mid(i,1));    
   debug.print b;   
   }
------解决方案--------------------//获得汉字的区位码    
   byte[]   array   =   new   byte[2];    
   array   =   System.Text.Encoding.Default.GetBytes( "啊 ");          
   int   i1   =   (short)(array[0]   -    '\0 ');    
   int   i2   =   (short)(array[1]   -    '\0 ');          
   //unicode解码方式下的汉字码    
   array   =   System.Text.Encoding.Unicode.GetBytes( "啊 ");    
   i1   =   (short)(array[0]   -    '\0 ');    
   i2   =   (short)(array[1]   -    '\0 ');          
   //unicode反解码为汉字    
   string   str   =    "4a55 ";