Click here to Skip to main content
15,892,072 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear All,

I am design the calculator in VC++ I use my own DLL and connect with form application.
I want to save the history of operation like (2+3=5) to file.txt.

when I try to write the function in DLL like this
void setHistory (string a, double b);

in form application I cannot convert textBox to string, I tried to use the marshal also but is not working.

System::String^ clrString = DisplayOperation->Text;
myf->setDisplayHistory(marshal_as<std::string xmlns:std="#unknown">gt;(clrString), LblDisplay->Text);
Posted
Comments
Sergey Alexandrovich Kryukov 15-Apr-15 9:14am    
What is DisplayOperation, LblDisplay? Where are the declarations?
—SA

1 solution

Dear Sergey,

all my declarations in my own DLL not in form that,
DisplayOperation->Text; and LblDisplay->Text; both are textBox

the function in DLL is
void Functions::setDisplayHistory(string a, double b)
{
ofstream readFile("Calculator.txt", fstream::in);
if (readFile.is_open())
{
readFile << a << " = " << b << endl;
readFile.close();
}
}


don't look the Functions:: and myf because there are connect with the name of project.
but why I cannot sent the string to function above it show me the error. and also it right
setDisplayHistory((error-type) *a, double b)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900