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?
Bryan Phillips - 27 Nov 2007 20:45 GMT
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
> I am still learning InfoPath, and have been going through the lab exercises
> to be found at this site:
[quoted text clipped - 31 lines]
> 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?
S.Y.M. Wong-A-Ton - 28 Nov 2007 09:33 GMT
The code in the lab is C++, not C#. As a pretty experienced coder, I myself
cannot say that that lab would be easy for me to follow.
Have you seen this article? It is the equivalent of the C++ version of that
lab and written for VB6, which should be much easier for you to follow:
http://blogs.msdn.com/ajma/articles/213868.aspx
There is also one in C#:
http://blogs.msdn.com/infopath/archive/2005/04/15/creating-an-infopath-custom-co
ntrol-using-c-and-net.aspx
---
S.Y.M. Wong-A-Ton
> I am still learning InfoPath, and have been going through the lab exercises
> to be found at this site:
[quoted text clipped - 31 lines]
> 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?