This part. Commented code is cs.
On compile catch an error:
Error 78 error C3766: 'Sample::NoteInfo' must provide an implementation for the interface method 'System::String ^System::ComponentModel::IDataErrorInfo::default::get(System::String ^)' d:\dev\docstreet\sample\pointInfoStoreClass.h 100
What's incorrect? Why VS compiler consider this not implemented?
#pragma region IDataErrorInfo Members
public: property String^ IDataErrorInfo[String^] {
virtual String^ get(String^ index) override {
return GetColumnError(index);
}
}
Full code:
public ref class NoteInfo : IDataErrorInfo {
int fDay;
int fMonth;
int fYear;
int fNoteID;
ProjectNotes^ owner;
Hashtable^ propertyErrors;
String^ fNoteError;
public: NoteInfo(int noteID, int day, int month, int year) {
fNoteID = noteID;
fDay = day;
fMonth = month;
fYear = year;
propertyErrors = gcnew Hashtable();
propertyErrors->Add("Day", "");
propertyErrors->Add("Month", "");
propertyErrors->Add("Year", "");
propertyErrors->Add("NoteID", "");
fNoteError = "";
Owner = nullptr;
}
public: property int NoteID {
int get() { return fNoteID; }
void set(int value) {
if(fNoteID == value) return;
fNoteID = value;
}
}
public: void ClearErrors() {
SetColumnError("Day", "");
SetColumnError("Month", "");
SetColumnError("Year", "");
fNoteError = "";
}
public: void SetColumnError(String^ elem, String^ error) {
if(propertyErrors->ContainsKey(elem)) {
if((String^)propertyErrors[elem] == error) return;
propertyErrors[elem] = error;
}
}
public: String^ GetColumnError(String^ elem) {
if(propertyErrors->ContainsKey(elem))
return (String^)propertyErrors[elem];
else
return "";
}
internal: property ProjectNotes^ Owner {
ProjectNotes^ get() { return owner; }
void set(ProjectNotes^ value) { owner = value; }
}
#pragma region IDataErrorInfo Members
public: property String^ IDataErrorInfo[String^] {
virtual String^ get(String^ index) override {
return GetColumnError(index);
}
}
public: property String^ Error {
virtual String^ get() { return fNoteError; }
}
#pragma endregion
};