Skip to main content

Search

Search

Sample Code For C# Does Not Work

Comments

3 comments

  • Avatar
    Susan Chen
    Moderator
    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
  • Avatar
    Legacy Poster
    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
  • Avatar
    Legacy Poster

    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.