Click here to Skip to main content
15,895,462 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Debug vs Release Pin
Sebastian Schneider16-Mar-07 4:12
Sebastian Schneider16-Mar-07 4:12 
GeneralRe: Debug vs Release Pin
prasad_som16-Mar-07 4:17
prasad_som16-Mar-07 4:17 
GeneralRe: Debug vs Release Pin
Sebastian Schneider16-Mar-07 5:11
Sebastian Schneider16-Mar-07 5:11 
GeneralRe: Debug vs Release Pin
Jörgen Sigvardsson16-Mar-07 5:24
Jörgen Sigvardsson16-Mar-07 5:24 
GeneralRe: Debug vs Release Pin
James R. Twine16-Mar-07 9:11
James R. Twine16-Mar-07 9:11 
GeneralRe: Debug vs Release Pin
Jörgen Sigvardsson16-Mar-07 13:38
Jörgen Sigvardsson16-Mar-07 13:38 
AnswerRe: Debug vs Release Pin
baerten16-Mar-07 3:50
baerten16-Mar-07 3:50 
Questionloading a new Form (MS vc++ 2005) Pin
luhfluh16-Mar-07 3:00
luhfluh16-Mar-07 3:00 
Hi to all, I'm new to vc++ and I've read a bit on how to create a new form and load it (make it appear on screen). But i have this code and its corresponding error and would be glad if someone could point me in the right direction.
There's three forms, Form1 (login form) and gymMain a main interface. So what I tried to do is first load the application with gymMain and make its Visible state FALSE, next load Form1 (login) and upon confirmation of input, close Form1 and make gymMain visible. Now I try this with the below code and the erorr is shown below. All help/suggestions appreaciated.
regards

PS: I'm prety sure I used the header files appropriately but one never knows, ...D'Oh! | :doh:

--------------------------
code for Main application:
--------------------------
// GymManager.cpp : main project file.

#include "stdafx.h"
#include "Form1.h"
#include "gymMain.h"
#include "NewMember.h"
#include "search.h"

using namespace GymManager;
//using namespace Form1;
//using namespace gymMain;
//using namespace NewMember;
//using namespace search;

[STAThreadAttribute]
int main(array<system::string ^=""> ^args)
{
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);

// Create the main window and run it
Application::Run(gcnew gymMain());
return 0;
}
----------------------------------------


code for gymMain:
----------------------------------
#pragma once
#include "NewMember.h"
#include "Form1.h"

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::Globalization;
using namespace GymManager;



namespace GymManager {

///
/// Summary for gymMain
///
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
///

public ref class gymMain : public System::Windows::Forms::Form
{
public:
gymMain(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//

}

protected:
///
/// Clean up any resources being used.
///

~gymMain()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::MenuStrip^ menuStrip1;
protected:
private: System::Windows::Forms::ToolStripMenuItem^ fileToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ logOutToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ exitToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ backupDBToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ backupNowToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ restoreToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ helpToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ aboutToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ howToToolStripMenuItem;
private: System::Windows::Forms::Button^ btnNewM;
private: System::Windows::Forms::Button^ btnSearch;
private: System::Windows::Forms::Button^ btnViewH;
private: System::Windows::Forms::Button^ btnCancelM;





private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Label^ lDateShow;

private: System::Windows::Forms::Button^ btnGymU;


private:
///
/// Required designer variable.
///

System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

void InitializeComponent(void)
{
this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
this->fileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->logOutToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->exitToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->backupDBToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->backupNowToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->restoreToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->helpToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->aboutToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->howToToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->btnNewM = (gcnew System::Windows::Forms::Button());
this->btnSearch = (gcnew System::Windows::Forms::Button());
this->btnViewH = (gcnew System::Windows::Forms::Button());
this->btnCancelM = (gcnew System::Windows::Forms::Button());
this->label2 = (gcnew System::Windows::Forms::Label());
this->lDateShow = (gcnew System::Windows::Forms::Label());
this->btnGymU = (gcnew System::Windows::Forms::Button());
this->menuStrip1->SuspendLayout();
this->SuspendLayout();
//
// menuStrip1
//
this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(3) {this->fileToolStripMenuItem,
this->backupDBToolStripMenuItem, this->helpToolStripMenuItem});
this->menuStrip1->Location = System::Drawing::Point(0, 0);
this->menuStrip1->Name = L"menuStrip1";
this->menuStrip1->Size = System::Drawing::Size(483, 24);
this->menuStrip1->TabIndex = 0;
this->menuStrip1->Text = L"menuStrip1";
//
// fileToolStripMenuItem
//
this->fileToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->logOutToolStripMenuItem,
this->exitToolStripMenuItem});
this->fileToolStripMenuItem->Name = L"fileToolStripMenuItem";
this->fileToolStripMenuItem->Size = System::Drawing::Size(35, 20);
this->fileToolStripMenuItem->Text = L"&File";
//
// logOutToolStripMenuItem
//
this->logOutToolStripMenuItem->Name = L"logOutToolStripMenuItem";
this->logOutToolStripMenuItem->Size = System::Drawing::Size(132, 22);
this->logOutToolStripMenuItem->Text = L"&LogOut...";
//
// exitToolStripMenuItem
//
this->exitToolStripMenuItem->Name = L"exitToolStripMenuItem";
this->exitToolStripMenuItem->Size = System::Drawing::Size(132, 22);
this->exitToolStripMenuItem->Text = L"E&xit";
//
// backupDBToolStripMenuItem
//
this->backupDBToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->backupNowToolStripMenuItem,
this->restoreToolStripMenuItem});
this->backupDBToolStripMenuItem->Name = L"backupDBToolStripMenuItem";
this->backupDBToolStripMenuItem->Size = System::Drawing::Size(69, 20);
this->backupDBToolStripMenuItem->Text = L"Backup &DB";
//
// backupNowToolStripMenuItem
//
this->backupNowToolStripMenuItem->Name = L"backupNowToolStripMenuItem";
this->backupNowToolStripMenuItem->Size = System::Drawing::Size(155, 22);
this->backupNowToolStripMenuItem->Text = L"&Backup Now...";
//
// restoreToolStripMenuItem
//
this->restoreToolStripMenuItem->Name = L"restoreToolStripMenuItem";
this->restoreToolStripMenuItem->Size = System::Drawing::Size(155, 22);
this->restoreToolStripMenuItem->Text = L"&Restore";
//
// helpToolStripMenuItem
//
this->helpToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->aboutToolStripMenuItem,
this->howToToolStripMenuItem});
this->helpToolStripMenuItem->Name = L"helpToolStripMenuItem";
this->helpToolStripMenuItem->Size = System::Drawing::Size(40, 20);
this->helpToolStripMenuItem->Text = L"&Help";
//
// aboutToolStripMenuItem
//
this->aboutToolStripMenuItem->Name = L"aboutToolStripMenuItem";
this->aboutToolStripMenuItem->Size = System::Drawing::Size(131, 22);
this->aboutToolStripMenuItem->Text = L"&About...";
//
// howToToolStripMenuItem
//
this->howToToolStripMenuItem->Name = L"howToToolStripMenuItem";
this->howToToolStripMenuItem->Size = System::Drawing::Size(131, 22);
this->howToToolStripMenuItem->Text = L"Ho&w to...";
//
// btnNewM
//
this->btnNewM->BackgroundImageLayout = System::Windows::Forms::ImageLayout::Center;
this->btnNewM->Location = System::Drawing::Point(15, 121);
this->btnNewM->Name = L"btnNewM";
this->btnNewM->Size = System::Drawing::Size(153, 57);
this->btnNewM->TabIndex = 2;
this->btnNewM->Text = L"New Member";
this->btnNewM->UseVisualStyleBackColor = true;
this->btnNewM->Click += gcnew System::EventHandler(this, &gymMain::btnNewM_Click);
//
// btnSearch
//
this->btnSearch->Location = System::Drawing::Point(188, 121);
this->btnSearch->Name = L"btnSearch";
this->btnSearch->Size = System::Drawing::Size(153, 57);
this->btnSearch->TabIndex = 3;
this->btnSearch->Text = L"Search Member";
this->btnSearch->UseVisualStyleBackColor = true;
//
// btnViewH
//
this->btnViewH->Location = System::Drawing::Point(15, 193);
this->btnViewH->Name = L"btnViewH";
this->btnViewH->Size = System::Drawing::Size(153, 57);
this->btnViewH->TabIndex = 4;
this->btnViewH->Text = L"View History";
this->btnViewH->UseVisualStyleBackColor = true;
//
// btnCancelM
//
this->btnCancelM->Location = System::Drawing::Point(188, 193);
this->btnCancelM->Name = L"btnCancelM";
this->btnCancelM->Size = System::Drawing::Size(153, 57);
this->btnCancelM->TabIndex = 5;
this->btnCancelM->Text = L"CancelMembership";
this->btnCancelM->UseVisualStyleBackColor = true;
//
// label2
//
this->label2->AutoSize = true;
this->label2->Font = (gcnew System::Drawing::Font(L"MS Reference Sans Serif", 15.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<system::byte>(0)));
this->label2->Location = System::Drawing::Point(12, 54);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(389, 26);
this->label2->TabIndex = 6;
this->label2->Text = L"Welcome to Personal Gym Manager";
//
// lDateShow
//
this->lDateShow->AutoSize = true;
this->lDateShow->Location = System::Drawing::Point(323, 35);
this->lDateShow->Name = L"lDateShow";
this->lDateShow->Size = System::Drawing::Size(78, 13);
this->lDateShow->TabIndex = 7;
this->lDateShow->Text = L"Time and date:";

//
// btnGymU
//
this->btnGymU->Location = System::Drawing::Point(364, 122);
this->btnGymU->Name = L"btnGymU";
this->btnGymU->Size = System::Drawing::Size(86, 127);
this->btnGymU->TabIndex = 8;
this->btnGymU->Text = L"Gym Usage";
this->btnGymU->UseVisualStyleBackColor = true;
//
// gymMain
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
this->ClientSize = System::Drawing::Size(483, 266);
this->Controls->Add(this->btnGymU);
this->Controls->Add(this->lDateShow);
this->Controls->Add(this->label2);
this->Controls->Add(this->btnCancelM);
this->Controls->Add(this->btnViewH);
this->Controls->Add(this->btnSearch);
this->Controls->Add(this->btnNewM);
this->Controls->Add(this->menuStrip1);
this->MainMenuStrip = this->menuStrip1;
this->MaximizeBox = false;
this->Name = L"gymMain";
this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
this->Text = L"Main Menu - Gym Manager";
this->Load += gcnew System::EventHandler(this, &gymMain::gymMain_Load);
this->menuStrip1->ResumeLayout(false);
this->menuStrip1->PerformLayout();
this->ResumeLayout(false);
this->PerformLayout();

}
#pragma endregion
private: System::Void btnNewM_Click(System::Object^ sender, System::EventArgs^ e) {
// gymMain::Visible = false;
// GymManager::NewMember ^newM = gcnew GymManager::NewMember;
// newM->Show();
}
private: System::Void gymMain_Load(System::Object^ sender, System::EventArgs^ e) {
//load login page and make main page invisible
this->Visible = false;
GymManager::Form1 ^login = gcnew GymManager::Form1;
login->Show();

//display clock
DateTime^ dt = DateTime::Now;
String^ date;
date = dt->ToString();
lDateShow->Text = date;

}

};
}

-------------------------------

error messages displayed:
-------------------------------
c:\documents and settings\and_one\my documents\visual studio 2005\cs208\gymmanager\gymmanager\gymMain.h(282) : error C2039: 'Form1' : is not a member of 'GymManager'
c:\documents and settings\and_one\my documents\visual studio 2005\cs208\gymmanager\gymmanager\gymMain.h(282) : error C2065: 'Form1' : undeclared identifier
c:\documents and settings\and_one\my documents\visual studio 2005\cs208\gymmanager\gymmanager\gymMain.h(282) : error C2065: 'login' : undeclared identifier
c:\documents and settings\and_one\my documents\visual studio 2005\cs208\gymmanager\gymmanager\gymMain.h(282) : error C2039: 'Form1' : is not a member of 'GymManager'
c:\documents and settings\and_one\my documents\visual studio 2005\cs208\gymmanager\gymmanager\gymMain.h(282) : error C2061: syntax error : identifier 'Form1'
c:\documents and settings\and_one\my documents\visual studio 2005\cs208\gymmanager\gymmanager\gymMain.h(283) : error C2227: left of '->Show' must point to class/struct/union/generic type
type is ''unknown-type''

luhfluh
AnswerRe: loading a new Form (MS vc++ 2005) Pin
David Crow16-Mar-07 3:10
David Crow16-Mar-07 3:10 
AnswerRe: loading a new Form (MS vc++ 2005) Pin
prasad_som16-Mar-07 3:12
prasad_som16-Mar-07 3:12 
GeneralRe: loading a new Form (MS vc++ 2005) Pin
luhfluh16-Mar-07 3:35
luhfluh16-Mar-07 3:35 
GeneralRe: loading a new Form (MS vc++ 2005) Pin
prasad_som16-Mar-07 3:39
prasad_som16-Mar-07 3:39 
GeneralRe: loading a new Form (MS vc++ 2005) Pin
luhfluh16-Mar-07 4:02
luhfluh16-Mar-07 4:02 
AnswerRe: loading a new Form (MS vc++ 2005) Pin
prasad_som16-Mar-07 4:12
prasad_som16-Mar-07 4:12 
GeneralRe: loading a new Form (MS vc++ 2005) Pin
luhfluh16-Mar-07 4:51
luhfluh16-Mar-07 4:51 
JokeRe: loading a new Form (MS vc++ 2005) Pin
James R. Twine16-Mar-07 3:32
James R. Twine16-Mar-07 3:32 
AnswerRe: loading a new Form (MS vc++ 2005) Pin
Programm3r16-Mar-07 4:46
Programm3r16-Mar-07 4:46 
Question[OT] Pin
prasad_som16-Mar-07 5:36
prasad_som16-Mar-07 5:36 
QuestionOverriding cursor icon Pin
Sydes16-Mar-07 2:39
Sydes16-Mar-07 2:39 
QuestionProblem with XP 64 version Pin
Epi16-Mar-07 2:35
Epi16-Mar-07 2:35 
QuestionHow to create a Line graph Pin
Trevy16-Mar-07 2:33
Trevy16-Mar-07 2:33 
AnswerRe: How to create a Line graph Pin
Cedric Moonen16-Mar-07 2:35
Cedric Moonen16-Mar-07 2:35 
QuestionHow to trap Enter key pressed in textbox Pin
viral_umang@hotmail.com16-Mar-07 2:31
viral_umang@hotmail.com16-Mar-07 2:31 
AnswerRe: How to trap Enter key pressed in textbox Pin
David Crow16-Mar-07 2:41
David Crow16-Mar-07 2:41 
GeneralRe: How to trap Enter key pressed in textbox Pin
viral_umang@hotmail.com16-Mar-07 3:00
viral_umang@hotmail.com16-Mar-07 3:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.