[.net] from String* to String*[] ?

Started by
3 comments, last by Jnz86 18 years, 9 months ago
Hi, i am trying to compile this code(C++ .net), but i couldn't get it to work!

static void AppendText(String* p_Str)
{
String* Line = String::Concat("\r\n", p_Str);

m_Console->richTextBox1->Invoke(new AppendDe(dynamic_cast<TextBoxBase*>
					(m_Console->richTextBox1)
					,&TextBoxBase::AppendText),Line);
}


The compiler shows the following error:

error C2664: 'System::Object __gc *System::Windows::Forms::Control::Invoke(System::Delegate __gc *,System::Object __gc * __gc[])' : cannot convert parameter 2 from 'System::Collections::ArrayList __gc *' to 'System::Object __gc * __gc[]'
        Can only convert a __gc array to or from Object * or Array *


I also tried to write String* Line[] = ... but it didn't work Can anyone help me ? I have been trying to figure out this for almost a hour without any success ;( [Edited by - Jnz86 on June 29, 2005 2:27:12 PM]
Advertisement
Side note: please (re)name your post...

Cheers
Well, it cannot convert from an ArrayList type to an array. You might want to try calling the ToArray() member of the ArrayList class.

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

Quote:Original post by Washu
Well, it cannot convert from an ArrayList type to an array. You might want to try calling the ToArray() member of the ArrayList class.


i will try...
Quote:Original post by Jnz86
Quote:Original post by Washu
Well, it cannot convert from an ArrayList type to an array. You might want to try calling the ToArray() member of the ArrayList class.


i will try...


You are right, it works! :)
Thanks

This topic is closed to new replies.

Advertisement