Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using multiple forms 1

Status
Not open for further replies.

Kurono

Programmer
Mar 22, 2006
4
IE
I'm writing a protocol analyzer for a college project. Its going suprisingly well, except because I'm new to Visual C++ .Net 2003 I'm having problems with the basic stuff :(

My latest problem is displaying a second form! I have two forms, form1.h and createfilter.h. In form1.h I've added #include "createfilter.h" but it still doesnt recognise the createfilter form.

The following code is in form1.h:

private: System::Void menuItem25_Click(System::Object * sender, System::EventArgs * e)
{
createfilter *filterform = new createfilter;
filterform->Show();
}

This gives the errors:

error C2061: syntax error : identifier 'createfilter'
error C2065: 'createfilter' : undeclared identifier
error C2065: 'filterform' : undeclared identifier
error C2227: left of '->Show' must point to class/struct/union
error C3861: 'filterform': identifier not found, even with argument-dependent lookup

and heres a bit of createfilter.h:
#pragma once

//#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;

namespace stuff
{

public __gc class createfilter : public System::Windows::Forms::Form
{
public:
createfilter(void)
{
InitializeComponent();
}

protected:
void Dispose(Boolean disposing)
{
if (disposing && components)
{
components->Dispose();
}
__super::Dispose(disposing);
}
Is the problem that they have different namespaces?
Initially both forms had the same namespace but I switched the second forms namespace to "stuff" (I've a bad imagination) when the compiler complained that the same namespace was used more than once.
Can anyone see what I'm doing wrong?
Any help is seriously appreciated.
 
Thanks for the quick reply cpjust! That worked perfectly :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top