0
votes

I'm working on a beginners level project in creating a UI that calculate a worker's working hours using Visual Studio and a windows form. My error is in the following function where I attempt to assign values to text boxes. All of the "ToDouble" show the error class "System::String" has no member "ToDouble" and towards the end (S"F") shows Identifier S is undefine and expected )

void CalculateWeeklyHours(void)
         {
             double monday, tuesday, wednesday, thursday,
       friday, saturday, sunday, totalHours;

monday     = this->txtMonday->Text->ToDouble(0);
tuesday    = this->txtTuesday->Text->ToDouble(0);
wednesday  = this->txtWednesday->Text->ToDouble(0);
thursday   = this->txtThursday->Text->ToDouble(0);
friday     = this->txtFriday->Text->ToDouble(0);
saturday   = this->txtSaturday->Text->ToDouble(0);
sunday     = this->txtSunday->Text->ToDouble(0);

totalHours = monday + tuesday + wednesday + thursday +
             friday + saturday + sunday;
this->txtTotalHours->Text = totalHours.ToString(S"F");
             throw(gcnew System::NotImplementedException);
         }

Full code here http://ideone.com/ySgxp1

c:\users\administrator\documents\visual studio 2012\projects\form1\form1\TimeSheet1.h(604): error C3921: Use of S-prefixed strings requires /clr:oldSyntax command line option 1> When compiling with /clr, an implicit conversion exists from string literal type to System::String^. If necessary to avoid ambiguity, cast to System::String^ 1>c:\users\administrator\documents\visual studio 2012\projects\form1\form1\TimeSheet1.h(594): error C2039: 'ToDouble' : is not a member of 'System::String' 1> c:\program files (x86)\reference assemblies\microsoft\framework.netframework\v4.5\mscorlib.dll : see declaration of 'System::String' 1>c:\users\administrator\documents\visual studio 2012\projects\form1\form1\TimeSheet1.h(595): error C2039: 'ToDouble' : is not a member of 'System::String' 1> c:\program files (x86)\reference assemblies\microsoft\framework.netframework\v4.5\mscorlib.dll : see declaration of 'System::String' 1>c:\users\administrator\documents\visual studio 2012\projects\form1\form1\TimeSheet1.h(596): error C2039: 'ToDouble' : is not a member of 'System::String' 1> c:\program files (x86)\reference assemblies\microsoft\framework.netframework\v4.5\mscorlib.dll : see declaration of 'System::String' 1>c:\users\administrator\documents\visual studio 2012\projects\form1\form1\TimeSheet1.h(597): error C2039: 'ToDouble' : is not a member of 'System::String' 1> c:\program files (x86)\reference assemblies\microsoft\framework.netframework\v4.5\mscorlib.dll : see declaration of 'System::String' 1>c:\users\administrator\documents\visual studio 2012\projects\form1\form1\TimeSheet1.h(598): error C2039: 'ToDouble' : is not a member of 'System::String' 1> c:\program files (x86)\reference assemblies\microsoft\framework.netframework\v4.5\mscorlib.dll : see declaration of 'System::String' 1>c:\users\administrator\documents\visual studio 2012\projects\form1\form1\TimeSheet1.h(599): error C2039: 'ToDouble' : is not a member of 'System::String' 1> c:\program files (x86)\reference assemblies\microsoft\framework.netframework\v4.5\mscorlib.dll : see declaration of 'System::String' 1>c:\users\administrator\documents\visual studio 2012\projects\form1\form1\TimeSheet1.h(600): error C2039: 'ToDouble' : is not a member of 'System::String' 1> c:\program files (x86)\reference assemblies\microsoft\framework.netframework\v4.5\mscorlib.dll : see declaration of 'System::String' 1>TimeSheet1.cpp(7): warning C4829: Possibly incorrect parameters to function main. Consider 'int main(Platform::Array^ argv)'

1

1 Answers