Sign in to follow this  
Jnz86

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

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Well, it cannot convert from an ArrayList type to an array. You might want to try calling the ToArray() member of the ArrayList class.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this