# VC++.net 'array': undeclared identifier

This topic is 4832 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Erg... I've never used the .net framework before, and I can't find much in the way of tutorials on the internet. Anyway, I'm trying to compile a peice of code from the help files, which uses "array<Char>^". However, when I enter that into my "Windows Forms Application (.net)", it gives me 'array': undeclared identifier. 'array' is appearing in blue, like a built in type--int, if, for, etc, which to me says that the IDE is considering 'array' as a built in type and therefore 'array': undeclared identifier is like saying 'if': undeclared identifier. Can anyone give me any clue as to what's wrong? And just for completeness:
//...
using namespace System;
//...
private: System::Windows::Forms::TextBox^  UnicodeInput;
private: System::Windows::Forms::TextBox^  UTF8Input;
//...
private: System::Void Unicode_TextChanged(System::Object^  sender, System::EventArgs^  e)
{
if(!sender->Equals(UTF8Input))
{
String^ UnicodeStr = UnicodeInput->Text;
System::Text::Encoding^ eUTF8 = System::Text::Encoding::UTF8;
System::Text::Encoding^ eUnicode = System::Text::Encoding::Unicode;
array<Byte>^ UnicodeBytes = eUnicode->GetBytes(UnicodeStr);
array<Byte>^ UTF8Bytes = System::Text::Encoding::Convert(eUnicode, eUTF8, UnicodeBytes);
array<Char>^ CharBytes = gcnew array<Char>(UTF8->GetCharCount( UTF8Bytes, 0, UTF8Bytes->Length ));
UTF8->GetChars(UTF8Bytes, 0, UTF8Bytes->Length, CharBytes, 0);
UTF8Input->Text = gcnew String(CharBytes);
}
}
//...


(keep in mind this is my first try at the .net framework, so there's bound to be numerous things wrong with the code.) (...tutorials would help...)

• 10
• 9
• 13
• 41
• 15