title: Using Text Encoding in C++/CLI
body: <p>I am using:</p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/system.net.sockets.tcpclient.aspx#Y2160" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.net.sockets.tcpclient.aspx#Y2160</a></p>
  
  <p>to connect and get information from a server. This is my code:</p>
  
  <pre><code>// Connect to the server
  TcpClient^ client = gcnew TcpClient( "1.1.1.1", 45257 );
  
  // Get stream
  NetworkStream^ stream = client-&gt;GetStream();
  
  // Data to send
  array&lt;Byte&gt;^data = Text::Encoding::ASCII-&gt;GetBytes( message );
  
  // Send data to server
  stream-&gt;Write( data, 0, data-&gt;Length );
  </code></pre>
  
  <p>However, I am getting these errors:</p>
  
  <pre><code>error C3083: 'Encoding': the symbol to the left of a '::' must be a type
  error C2039: 'ASCII' : is not a member of 'System::Windows::Forms::Form::Text'
  error C2065: 'ASCII' : undeclared identifier
  error C2227: left of '-&gt;GetBytes' must point to class/struct/union/generic type
  </code></pre>
  
  <p>This is inside of a windows form application.</p>
  
  <p>Any help would be appreciated. Thanks</p>