   Visual C++ IDE Functions
  Hello,I am designing a Calendar that populates the controls I have setup on a form. It basically uses some preexisting .NET functions to determine the month, year, and first day of the month. That part is fine, and I have a user control that creates an instance of itself and that is put into each Row and Column of a Table Layout Panel. This all works absolutely great.However I wish to add a feature that when the user clicks on a day on the calendar it opens a new form. This new form would allow me to edit labels, and such on the current user control instance. I am having a problem accessing Form #2(called options) and the User Control(called test). It is giving me declaration errors, and it should not be. Any help would be greatly appreciated.test ^dayform = gcnew test;The above piece of code is how I am accessing the User Control from my original Form #1. This works fine, however Visual C++ seems to want to put its code in the header file which seems like a bad move. And in doing so, I think is causing my complications, I can not access "test" from the "options" form and vice versa. I have included the header files in my header file, and even tried forward declaration. Nothing seems to work. Please help.   
  Hello,Can you give the exact error mesage?; i believe that the classes are in different namespaces or something similar;PS: IDE stands for `integrated development environment` (editor in which you write your code: ex: Visutal Studio), use instead GUI (graphical user interface) otherwise you confuse peopleRaxvan   ;  Here is my code inside of my User Control's header file. My second form which is named "options" has its header included:options ^optionsform = gcnew options;Quote:error C2065: 'options' : undeclared identifiererror C2065: 'optionsform' : undeclared identifiererror C2061: syntax error : identifier 'optionsIt doesn't make sense. I do the same EXACT thing in the main Form's file to access my User Control named "test". I just want to access options->showdialog(); and be able to say ok options->label1->text = test->label1->text. Simple stuff, but it seems the instances arn't working?   ; I already told you, you have a mutual inclusion problem. Move the definitions of your functions into the source files, not the headers. And seriously, as I said before, if you can't figure out how to fix this kind of problem without help, you shouldn't be using C++/CLI. C++/CLI is intended for people who are already very familiar with standard C++.   ;  Well I am sorry I don't know how, I am trying to learn. However I want to get better at C++ as I also told you. If you could please help me solve this I shouldn't have issues for a while, being how I never used the GUI part of C++. With that being said, I move my function definition to my .cpp file. It compiles and never runs my code:Declared as:private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e);Defined as:void Form1::Form1_Load(System::Object^  sender, System::EventArgs^  e) {Form1 ^mform = gcnew Form1;int year;int month;int daycounter;int totaldays;int Row,Column;Row = 1;Column = -1; //set to (Day of Week) - (2) for correct Day --Defaults to Sunday//Find the current Year and MonthSystem::DateTime moment = System::DateTime( mform->monthCalendar1->SelectionStart );year = moment.Year;month = moment.Month;//This code determines the beginning of each month, based on system time.System::DateTime moment2 = System::DateTime( year, month, 1, 0, 0, 0 );switch ( moment2.DayOfWeek ){case 0: //SundayColumn = -1;break;case 1: //MondayColumn = 0;break;case 2: //TuesdayColumn = 1;break;case 3: //WednesdayColumn = 2;break;case 4: //ThursdayColumn = 3;break;case 5: //FridayColumn = 4;break;case 6: //SaturdayColumn = 5;break;default: //Default to SundayColumn = -1; break;}totaldays = System::DateTime::DaysInMonth(year, month);//day counter starts at the first day of the month//total days in the current month is setup above.for(daycounter = 1; daycounter <= totaldays; daycounter++){Column++; //advance one day of the weekif ((Column >= 7)) //if we have hit saturday or gone past our 7 days.{Column = 0; //resetRow++; //and drop down a row.}//Create an instance of our user control for each daytest ^dayform = gcnew test;//set the number of each day in our main label on our user controldayform->label1->Text = daycounter.ToString();//add our user control to each spot on the panelmform->tableLayoutPanel1->Controls->Add(dayform, Column, Row);} }Now I am somewhat lost as to what the problem is, my function is never called. I would assume its because of how it is called in the header file:this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);If you could please help, maybe spend a couple minutes it would be great. Online help is utterly useless and the two books I have do not touch managed code, or the GUI side of things. Thank you....   ;  C++/CLI is terrible for learning C++. Instead of learning standard C++ you're learning a bastardized Microsoft-specific language. C++/CLI was designed for C++/managed interop scenarios; using it outside of those scenarios doesn't make sense when there are more appropriate languages.Now regarding your most recent question, you're confusing subscribing to an event (the Load += syntax) with raising that event (the act of invoking all subscribers of the event). Here's some C# background information on events.Doing Load += Form1_Load does not call Form1_Load. Instead, what it does is subscribe to the Load event so that when Load is raised, Form1_Load is called. The Load event is raised when the form is loaded, so you need to either call Form.Show or Form.ShowDialog. The event is not directly raised by your code.Full code would look something like this in C#:using System;using System.Windows.Forms;public class Form1 : Form{  public Form1()  {    Load += Form1_Load;  }  private void Form1_Load(object sender, EventArgs e)  {    int year;    int month;    ...  }}class Program{  static void Main()  {    // Construct the Form1 object.    Form1 form = new Form1();    // Now actually show the form via Application.Run, which internally calls    // Form1.Show. You could also show it via Form1.Show or ShowDialog.    Application.Run(form);  }};  Yeah I agree, I know .NET is not the best way to go. VB/C# is a much better way to handle this type of stuff probably. But I really want to improve my C++ skills, and I figured I could find small programs to create to do so.   ;Quote:Original post by tron86Yeah I agree, I know .NET is not the best way to go. VB/C# is a much better way to handle this type of stuff probably. But I really want to improve my C++ skills, and I figured I could find small programs to create to do so.If you want to improve your C++ skills then use C++. Using C++/CLI is doing you a disservice. You'll eventually find that you've learned a language that resembles C++, but isn't quite C++, and is a language that not many people use. At that point you'll have to spend more time to learn proper C++.Besides, the code you've posted is effectively C# in ugly syntax. Once you start using C++ features you'll likely unknowingly learn very awkward ways of using those features because they may interact with C++/CLI in weird ways. Templates was one example of C++/CLI weirdness that I experienced.   ;Quote:Original post by mutexTemplates was one example of C++/CLI weirdness that I experienced.I know effectively nothing about C^^ C++/CLI, but as far as I am informed about it, templates are distinct from generics (which is the right thing in such a glue glibbery). So my question: What is weird with C++/CLI-templates?   ;  There's nothing inherently wrong with C++/CLI templates, and they work with generics to a certain degree. But here's at least two oddities I've experienced:1) You can write managed classes that inherit from templates, and this'll compile fine. But the resulting base class's name is not mangled to form a valid C# identifier, and this appears to break Intellisense for all such classes when used from a C# assembly.template <typename T> ref class Base { };ref class Derived : Base<int> { };// Derived will not have Intellisense when used from a C# assembly.2) I don't have the exact code in front of me, but I believe the following rough reproduction is a bug:template <typename T> ref class WillCompile : System::IEquatable<T^> { /*IEquatable members*/ };template <typename T> ref class WillNotCompile : System::Collections::Generic::IEnumerable<T^> { /*IEnumerable<T^> members, IEnumerable members*/ };Unfortunately, it's been long enough that I don't remember the other issues in enough detail, but at least a few were things I worked around by writing slightly awkward code because I never found the correct solutions, assuming they even existed.Ultimately C++/CLI worked great as a layer between native (COM in my case) and managed code, but I can't think of any other scenario where C++/CLI would make sense.   