473,395 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Passing an instance of System::Windows::Forms::Form to another class

Hi!
Could you please tell me what am I doing wrong here....

I've got a simple form called Form1 and all I want to do is to pass
the pointer to my other class called CCueMakerEngine. Here's what I've
got:

In Form1.h:
----------------------------
#pragma once

#include ".\cuemakerengine.h"

namespace CueMaker
{
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

public __gc class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
CCueMakerEngine* pCCMakeEng = new CCueMakerEngine(this);

InitializeComponent();
}
....
};
}

In "CueMakerEngine.cpp":
------------------------------------------------------------------------
#include "StdAfx.h"
#include ".\cuemakerengine.h"

#using <mscorlib.dll>

CCueMakerEngine::CCueMakerEngine(CueMaker::Form1 __gc *const)
{

}

CCueMakerEngine::~CCueMakerEngine(void)
{
}
In "CueMakerEngine.h":
------------------------------------------------------------------------

#pragma once
#include "Form1.h"

class Form1;

class CCueMakerEngine
{
public:
CCueMakerEngine(Form1 __gc *const);
virtual ~CCueMakerEngine(void);
private:

};
**
I get the error:
error C2664: 'CCueMakerEngine::CCueMakerEngine(Form1 __gc *const )' :
cannot convert parameter 1 from 'CueMaker::Form1 __gc *const ' to
'Form1 __gc *const '

If I then replace:
CCueMakerEngine(Form1 __gc *const); (in CueMakerEngine)
to:
CCueMakerEngine::CCueMakerEngine(CueMaker::Form1 __gc *const )

the compiler then does not recognise the CueMaker namespace...
error C2653: 'CueMaker' : is not a class or namespace name
Form1.cpp(13) : error C2872: 'Form1' : ambiguous symbol

Could you please give me your help
Thanks
Telis

May 4 '07 #1
0 1320

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: gregory_may | last post by:
This code seems to "work" but I get the following errors: An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll then this one: An unhandled...
4
by: Bilo | last post by:
I have a Windows Forms Class MainGUI I have declared MainGUI maingui; public System.ComponentModel.Container components = new Container(); in the Class I call another class MediaDriver with...
2
by: Daniel P. | last post by:
Since multiple inheritance does not exist in C# I would like to be able to subclass the Form and then have other class subclass MyForm. If I do that then the designer will not see my classes as...
0
by: Jason Garland \(Secure Access Pty Ltd\) | last post by:
Any ideas on how to cure the following error ? The designer could not be shown for this file because none of the classes within it can be designed. The designer inspected the following classes...
1
by: msnews.Microsoft.com | last post by:
Hi , How to edit the windows forms imagelist icons using Reseditor utility for binary files. Thanks. Narayan.
0
by: Eugene | last post by:
Hi All, I uses System.Windows.Forms.Form.ActiveForm to get the form with the current control having the focus. However, I got a problem when my application pops up another ShowDialog form. The...
1
by: Piotr | last post by:
This method not work. System.Windows.Forms.Form.Refresh() work good. Microsoft.Net Framework 1.1. _ This code not work. Should be work. Terrorism? .... Method2(Method()); .... public...
4
by: Piotr | last post by:
1. When i refresh control, position of scrollbars is deleted. I can not change BackgroundImage from System.Windows.Forms.RichTextBox before text of control is painted and after. I tried use...
6
by: jojoba | last post by:
Hi, I am trying to create a .net webservice such that: When a user calls the service, the server creates a System.Windows.Forms.Form and shows it on the server screen. I know this sounds...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.