Thread: Pass a List<double>^ to an opening Form

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    59

    Pass a List<double>^ to an opening Form

    In wonder if I can pass a List<double> to another Form when this form opens ?
    Code:
    List<double>^ ExampleList = gcnew List<double>; //ExampleList has for example 50 elements

    With the code below I can pass a String^ from Form1 to Form2 that opens.
    I get this passed string as in this example: getstring1.

    I wonder if it is possible to pass a List in this same way or any simular way ?
    Thank you...

    Code:
    String^ string1;
    Form2 ^form2 = gcnew Form2(string1); //Pass string1 to the opening Form2
    form2->Show();
    Code:
    Form2( String^ getstring1)
    {
    	InitializeComponent();
    	//
    	//TODO: Add the constructor code here
    	//
    }
    Last edited by franse; 01-06-2009 at 01:37 PM.

  2. #2
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    Code:
    Form2( List<double>^ list)
    {
    	InitializeComponent();
    	//
    	//TODO: Add the constructor code here
    	//
    }
    Is that what you mean? You can do this with any type...
    By the way what does ^ mean? Reference/pointer I guess? It is Visual C++

  3. #3
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by C_ntua View Post
    By the way what does ^ mean? Reference/pointer I guess? It is Visual C++
    It's some kind of Microsoft crapification of the C++ language. I usually just skip over posts that use "Managed C++".
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  4. #4
    Registered User
    Join Date
    Aug 2008
    Posts
    188
    Quote Originally Posted by cpjust View Post
    It's some kind of Microsoft crapification of the C++ language. I usually just skip over posts that use "Managed C++".
    ^ and % are the same as * and & except they are used to differentiate between managed types and native types. this was added in C++/CLI. managed C++ is the older version which used */& for both managed/native and it was extremely confusing so they changed it.

  5. #5
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    So, to conclude you can pass anything you want with a reference and use it normally.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reopening a form ?
    By Aga^^ in forum C# Programming
    Replies: 1
    Last Post: 02-11-2009, 09:28 AM
  2. Calling datas from another form?
    By Aga^^ in forum C# Programming
    Replies: 2
    Last Post: 02-06-2009, 02:17 AM
  3. Speed test result
    By audinue in forum C Programming
    Replies: 4
    Last Post: 07-07-2008, 05:18 AM
  4. Form
    By Coding in forum C++ Programming
    Replies: 1
    Last Post: 01-25-2008, 04:13 PM
  5. Replies: 3
    Last Post: 11-22-2007, 12:58 AM