• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

using Visual C++ for the first time

chorb

Golden Member
I have my GUI form all set up, and when I click on a button I want to have a custom function (addNums) called, but I keep getting an error that says
" 'addNums' identifier not found "

Here is my code for the event handler:

private: System::Void button1_Click(System:: Object^ sender, System::EventArgs^ e) {
double Number1, Number2, Result;

Number1 = Convert::ToDouble(textBox1->Text);
Number2 = Convert::ToDouble(textBox2->Text);
if(radioButton1->Checked == true) {
textBox3->Text = addNums(Number1, Number2);
}
}


I have my addNums function set up in my main source file, what am I doing wrong?

This is just something I am playing around with trying to get the feel for Visual C++ and I realize I can just add the two numbers within the event call.
 
are you including the header file that defines addnums in this cpp file?

did you mess up the capitalization between the two, or use different argument types? unlike VB and scripts C++ is case-sensitive and strongly typed.
 
Back
Top