Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Getting Started -- where do I put my functions?
Hi guys, I have a very basic question.
I've managed to figure out how to setup a form. It has a button which opens the open file dialog to select a file. Now I want to do some processing on that file when I click a "GO" button.
Dumb question: where do I put all the code that I've written to process that file? Do I stick it in Form1.h in the button_Click event handler? This is kind of awkward as it is a long bit of code and seems out of place in this file.
What I'd like to do is call a function like processFile() that I put in the program.cpp file VisualC++ created for me (the file with main() in it). But, when I put my processFile there and #include
"program.cpp" in Form1.h, I get all sorts of namespace errors. I admit I don't quite understand all this .net type stuff, but I am trying to learn.
If I get my code to live in an appropriate .cpp file, can I access things like form1->textBox1->Text from there?
There is no form1.cpp file either, should there be?
Apologies for this very basic question, I tried to search, but couldn't find anything on it. I found a lot of help setting up my form, but not actually using it to do anything useful.
Thanks in Advance
0 · ·