Solved

Placing the x-coordinate of the cursor in a variable

Posted on 2004-08-11
3
135 Views
Last Modified: 2010-05-18
To test whether I indeed have the value of the x-coordinate placed in the variable X upon clicking on the form I create a project with the following code in it:


private: System::Void Form1_MouseDown(System::Object *  sender, System::Windows::Forms::MouseEventArgs *  e)                     
                  {
               points->Add( __box( Point( e->X, e->Y ) ) );
               MessageBox::Show( e->X.ToString(), e->Y.ToString());
                  }

with the following included in the IntializeComponent function:

this->MouseDown += new System::Windows::Forms::MouseEventHandler(this, Form1_MouseDown);


Above code works very well.

However, when placing the same code (except for the change of the name of the form) in my main project within the form (say, plotting.h) the same:


private: System::Void plotting_MouseDown(System::Object *  sender, System::Windows::Forms::MouseEventArgs *  e)                     
                  {
            points->Add( __box( Point( e->X, e->Y ) ) );
                MessageBox::Show( e->X.ToString(), e->Y.ToString() );
                  }

and

this->MouseDown += new System::Windows::Forms::MouseEventHandler(this, plotting_MouseDown);


gives me the following errors:

plotting1.h(193): error C2065: 'points' : undeclared identifier
plotting1.h(193): error C2227: left of '->Add' must point to class/struct/union

Notice that upon compiling even the name of the form is changed from plotting.h to plotting1.h. What could be the reason for that?
0
Comment
Question by:judico
3 Comments
 

Author Comment

by:judico
ID: 11778895
I just fixed it. I've forgotten to place 'using namespace <whatever>;' in plotting1.cpp. The rest of the code is

private: System::Void plotting1_MouseDown(System::Object *  sender, System::Windows::Forms::MouseEventArgs *  e)                     
                  {
               points->Add( __box( Point( e->X, e->Y ) ) );
             MessageBox::Show( e->X.ToString(), e->Y.ToString() );
                  }

with

this->MouseDown += new System::Windows::Forms::MouseEventHandler(this, plotting1_MouseDown);
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 11859259
User resolved; closed, 250 points refunded.

Netminder
Site Admin
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Safearray problem c++ 4 75
VC++ 6.0 issue 3 65
Calling a DLL from CSharp --  How? 4 57
is twain_32.dll cmpatible with windows 10 ? 10 95
The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now