我有一个带有 a和 a的 windows 窗体 ( Form1.h
) 。初始化表单时为空。单击按钮时,将调用表单外部的方法,它应该更新. 我将如何从非表单类更新?下面是我的示例代码:Button
TextBox
TextBox
TextBox
TextBox
// Form1.h
private: System::Void findResultButton_Click(System::Object^ sender, System::EventArgs^ e) {
FirstResults* firstResults = new FirstResults();
firstResults->findResult();
}
// FirstResults.cpp
void FirstResults::findResult() {
// do some calculations here and find result.
// write the result value to a .txt file.
// Update TextBox in Form1.h with result value.
}