cancel
Showing results for 
Search instead for 
Did you mean: 

Revisit To error : An attempt was made to reference a token that does not exit

kennedy_shabola
Explorer
0 Kudos

Hallo  Experts ,

I  encounter this error " An attempt was made to reference a token that does not exit"    every time  i run an addon i have  created . I have also looked  at  this link     and adopted  Owen Slater Mar 11, 2007 9:20 PM  response   marked  as correct answer so i added the Thread.Sleep(10)    as shown in my code  but nothing  happens . Kindly help .

Public Sub SetApplication()

        '*******************************************************************

        '// Use an SboGuiApi object to establish connection

        '// with the SAP Business One application and return an

        '// initialized appliction object

        '*******************************************************************

        Dim SboGuiApi As New SAPbouiCOM.SboGuiApi

        Dim sConnectionString As String

        SboGuiApi = New SAPbouiCOM.SboGuiApi

        '// by following the steps specified above, the following

        '// statment should be suficient for either development or run mode

        sConnectionString = Environment.GetCommandLineArgs.GetValue(1)

        '// connect to a running SBO Application

        Try ' If there's no active application the connection will fail

            SboGuiApi.Connect(sConnectionString)

            'Suggestion  to given in  this link    

            Thread.Sleep(10)

        Catch ' Connection failed

            System.Windows.Forms.MessageBox.Show("No SAP Business One Application was found")

            End

        End Try

        '// get an initialized application object

        SBO_Application = SboGuiApi.GetApplication()

    End Sub

Accepted Solutions (0)

Answers (1)

Answers (1)

edy_simon
Active Contributor
0 Kudos

Hi Kennedy,

1. Which SBO Version are you using ? x86 or x64 ?

2. Which target platform are you using in your Visual Studio ?

Regards

Edy

kennedy_shabola
Explorer
0 Kudos

x 86

kennedy_shabola
Explorer
0 Kudos

x86    .Net 4  client Profile

edy_simon
Active Contributor
0 Kudos

Hi Kennedy,

I would get this error if your SBO client and VS platform is different and you have both SBO 32 bit and 64 bit installed on this machine.

But if you say you have both x86, that is strange.

1. Can you check on the connectionstring value and post it here ?

2. Does this happen during development or on client ?


Regards

Edy

kennedy_shabola
Explorer
0 Kudos

sConnectionString = Environment.GetCommandLineArgs.GetValue(1)

Below is my command line arguement

0030002C0030002C00530041005000420044005F00440061007400650076002C0050004C006F006D0056004900490056

It happens  During  Developement