Reputation: 2213
I am new to C++ so forgive my stupidity.
I have a text box and trying to get length of text box string value:
int length1 = 0;
length1 = this->txt_path->Text->Length();
However this gives me the following error:
error C2064: term does not evaluate to a function taking 0 arguments
Thanks, Bruce
Upvotes: 1
Views: 3163
Reputation: 101456
You didn't show us the declaration of Text
, but if it is declared as a std::string
, then you have a typo:
Text->length();
Case matters in C++.
If the object is an MFC CString
, then the name of the function is GetLength()
:
Text->GetLength()
Upvotes: 2
Reputation: 262939
In C++/CLI, String::Length
is a property, not a method. You should not use the call operator ()
with properties:
length1 = this->txt_path->Text->Length;
Upvotes: 5