Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 897033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:49:26+00:00 2026-05-15T14:49:26+00:00

Hey guys, I’m brand new to Visual C++, but not C++. I’m having issues

  • 0

Hey guys, I’m brand new to Visual C++, but not C++. I’m having issues trying to figure out how to show/hide forms.

Let’s say I have a form Form1 and another form TestForm. In a button click function in Form1.h I have the code:

Form1::Hide();
TestForm^ form = gcnew TestForm();
form->Show();

And it works fine. I click the button, and Form1 disappears and TestForm appears. But if I do the same thing in TestForm.h (just changing which forms are set to appear/disappear) I get a plethora of compiler errors in both Form1.h (which used to work) and TestForm.h

  Form1.cpp
c:\users\alex\documents\visual studio 2010\projects\test\test\TestForm.h(86): error C2065: 'Form1' : undeclared identifier
c:\users\alex\documents\visual studio 2010\projects\test\test\TestForm.h(86): error C2065: 'form' : undeclared identifier
c:\users\alex\documents\visual studio 2010\projects\test\test\TestForm.h(86): error C2061: syntax error : identifier 'Form1'
c:\users\alex\documents\visual studio 2010\projects\test\test\TestForm.h(87): error C2065: 'form' : undeclared identifier
c:\users\alex\documents\visual studio 2010\projects\test\test\TestForm.h(87): error C2227: left of '->Show' must point to class/struct/union/generic type
          type is ''unknown-type''
  TestForm.cpp
c:\users\alex\documents\visual studio 2010\projects\test\test\Form1.h(103): error C2065: 'TestForm' : undeclared identifier
c:\users\alex\documents\visual studio 2010\projects\test\test\Form1.h(103): error C2065: 'form' : undeclared identifier
c:\users\alex\documents\visual studio 2010\projects\test\test\Form1.h(103): error C2061: syntax error : identifier 'TestForm'
c:\users\alex\documents\visual studio 2010\projects\test\test\Form1.h(104): error C2065: 'form' : undeclared identifier
c:\users\alex\documents\visual studio 2010\projects\test\test\Form1.h(104): error C2227: left of '->Show' must point to class/struct/union/generic type
          type is ''unknown-type''
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T14:49:26+00:00Added an answer on May 15, 2026 at 2:49 pm

    The problem is most likely due to the order in which you’re including the headers into the .cpp files. In the original case, when you were working in Form1.cpp, “TestForm” was a known type before Form1.h was included. As soon as you switch the header files will your method calls, this isn’t the case anymore.

    I recommend moving your event handlers (the button click functions) to your .cpp files. Your .cpp files can both include both headers, and the compiler will find the form definitions, with their methods, appropriately, no matter what order you include the headers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hey guys having this really simple problem but cant seem to figure out have
hey guys was hoping you could help me out, Not sure if I always
Hey guys, sorry I'm kind of new to programming, but I had a small
Hey guys, am trying to write to do type casting in java, but i
Hey guys I'm tired and can't figure this one out so any help would
Hey guys I wanted to create a JScrollPane but it won't work... and I
Hey guys (and gals) I'm having a problem using Assembly GetExportedTypes() in .NET 4.0.
Hey guys am having a bit of problems with my jQuery, I have all
Hey guys was hoping you could help me out. basically i'm working on a
Hey guys i'm making a website but for some reason my div tags are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.