Sample Code For C# Does Not Work
after registering Bartender and trying the samples in Visual Studio 10.
The sample code is valid
Dim btApp As BarTender.Application; (ok)
btApp = new BarTender.ApplicationClass(); (Invalid token =) and (invalid '(' in class or invalid declaration.
This syntax seems to be wrong for C#.
The sample code is valid
Dim btApp As BarTender.Application; (ok)
btApp = new BarTender.ApplicationClass(); (Invalid token =) and (invalid '(' in class or invalid declaration.
This syntax seems to be wrong for C#.
0
-
Hi, jasH:
You can reference our white paper for ActiveX integration http://s3.amazonaws.com/SeagullBarTender/ftp/WhitePapers/WhitePaper_BarTendersActiveXAutomationInterface.pdf
The example is in C#. You can also reference our Bartender Help-> Automating Bartender-> Automation with ActiveX-> Examples using ActiveX Automation section. There are many program examples for C# and VB.net for opening label format, printing label formats, automating database printing....
C# does not use Dim declaration(It is used in VB). If you use C#, please use Bartender.ApplicationClass btApp to declare a Bartender application variable.
Hope it helps.0 -
Crud I pasted the wrong line from your sample. This is the code which is what is suggested for C#
All the samples published use this same initialization line.
namespace ClassLibrary4
{
public class Class1
{
public void init()
{
BarTender.Application btApp;
BarTender.Format btFormat;
btApp = new BarTender.ApplicationClass(); / Error here
btFormat = btApp.Formats.Open("c:\\test.btw", false, "");
btFormat.EnablePrompting(true); /Error here
1. Interop type 'BarTender.ApplicationClass' cannot be embedded. Use the application interface instead.
2. Non-invocable member 'BarTender.IBtFormat.EnablePrompting' cannot be used like a method.0 -
the correct answer:
namespace ClassLibrary4
{
public class Class1
{
public void init()
{
BarTender.Application btApp;
BarTender.Format btFormat;
btApp = new BarTender.Application(); // Error here 1. Interop type 'BarTender.ApplicationClass' cannot be embedded. Use the application interface instead.
btFormat = btApp.Formats.Open("c:\\test.btw", false, "");
btFormat.EnablePrompting = true; //Error here 2. Non-invocable member 'BarTender.IBtFormat.EnablePrompting' cannot be used like a method.
0
Please sign in to leave a comment.
Comments
3 comments