CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2013
    Posts
    29

    how to pass value from one form to another?

    Hi everybody,

    i am trying to create a form app with multiple forms. there is a form i'm using as "search". i want to take the value of the textbox in search-form and pass it to another form which shows the result of the search. i've tried to include search-form.h in the form of the result but it returns an error.

    Code:
    	
    String ^ key;
    key = searchbox->Text;
    std::string ks = marshal_as<std::string>(key);
    ks=ks+".bin";
    
    
    	ifstream sfile(ks);
    			
            	if (sfile)
    		{
                       PatInfo ^ form = gcnew PatInfo;
    		   form->ShowDialog();
    					
    		}												
    		else 
    			{
     			 MessageBox::Show( "Please try again.");
    			}
    to conclude, i want the form PatInfo to open an receive the "ks" var. thanks in advance!!

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: how to pass value from one form to another?

    Your code has nothing to do with the Visual C++ nor is it a native C++ one. So you have posted your question in the wrong forum.
    Try to ask somewhere in .Net or in a Managed C++ forums.
    Victor Nijegorodov

  3. #3
    Join Date
    Feb 2013
    Posts
    29

    Re: how to pass value from one form to another?

    thanks!! and i'm sorry. should i erase the post somehow??

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: how to pass value from one form to another?

    No. You cannot erase it. Only Administrator can remove and/or move posts to another forum.
    Victor Nijegorodov

  5. #5
    Join Date
    Feb 2013
    Posts
    29

    Re: how to pass value from one form to another?

    ok i'll just post it inmanaged c++ forum. thanks again

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured