Basic question about using custom files/classes

Hey there,

I know C++ fairly well and in order to learn Windows Forms I decided to make a calendar application. Here is the layout i spent some time on using the designer. (the main parts including the days arent included yet due to my problem)


I have no problem making simple interaction with these controls, for example. I have the "Next" and "Previous" buttons scroll through the months of the year, and the corresponding year is displayed in the label above the buttons.

This was simple for me to figure out because I declared and used my integer(identifies the current month) right in Form1.h. However, as almost all applications, my project requires custom classes and files. So, say i want to create MyFile.cpp and MyFile.h and within them, i declare some type of string. When i have this string initialized, I would like for it to be displayed in the lower text box. My question is, how do i connect this "inner" data with the controls. Or, the other way around, how can i have, for example, a button affect the value of an interger which I have in a custom class or file.

Thanks in advance


Answer this question

Basic question about using custom files/classes

  • ueoctudorprice

    The easiest way is to pass the reference of the object you want to manipulate using the constructor of your other classes or by assigning a property of your class to the object reference.
  • Thomas Mauer

    hm il try that. thx for the help :)

  • Basic question about using custom files/classes