Having trouble with training lab exercise

B

Bev Kaufman

I am still learning InfoPath, and have been going through the lab exercises
to be found at this site:
http://msdn2.microsoft.com/en-us/library/Aa167916(office.11).aspx.

Lab 6 is how to create an ActiveX control to be use in an InfoPath form. I
am seriously handicapped in that it requires an understanding of C#, while my
background is in VB. But I plowed ahead, following each instruction
precisely. And I got 5 errors to try to figure out.

I will list just the first one:
c:\Programs\ActiveX\SampleControl.h(33): error C2864: 'm_nCurrentValue' :
only const static integral data members can be initialized inside a class or
struct
Here is line 33:
long m_nCurrentValue;
Here are the instructions that put it there:
1. We need to keep track of the current count. We begin by creating a
variable which stores the running total. Locate the class definition (in the
SampleControl.h file) and after the opening curly brace({) and the public
declaration, add:
long m_nCurrentValue;
2. Also, we should initialize it to zero, so within the class constructor,
add:
m_nCurrentValue=0;
So, here is the class declaration:
class ATL_NO_VTABLE CSampleControl :
And here is the first curly brace, followed by public:
{
public:
long m_nCurrentValue;
m_nCurrentValue=0;
And I put my code immediately after, just like the instructions said.

Obviously the code doesn't go where I was told to put it, but I can't figure
out where. Does anyone know what's wrong with this?
 
B

Bryan Phillips

I would stay away from C++ unless you already are comfortable with it.
The better option would be to use VB6 or VB.Net to create a class
library with a WinForms user control inside and embed that instead. If
you are feeling adventurous, embed the Silverlight plug-in and write
XAML instead.

--
Bryan Phillips
MCT, MCSD, MCDBA, MCSE
Microsoft MVP - Client Application Development
Blog: http://bphillips76.spaces.live.com
Web Site: http://www.composablesystems.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top