function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Accessing the sforce object in child API forms


I am working on a little app in windows forms using C#.  To this point I have succeeded in working with the API in a single form, but now need to expand to multiple forms.  I am using our org's Enterprise WSDL in the Mdi application. The parent Mdi form contains the code delcaring binding as the sforce variable in the constructor:

public sforce.SforceService binding;

When the parent mdi form opens it automatically opens a child login form with text box's for username and password as well as a login button.

if I instantiate binding in the login button event (binding = new sforce.SforceService(), it works fine as long as I create an instants of the mdi parent and cast it to a new variable, but the problem is that the variable 'binding' is limited to that sub only.  So I added it as a constructor after the initializecomponent(); call, but that falls through to an exception in the login process.  Where should I instantiate binding in order to access it anywhere on the form, as well access it on a 3rd form used to search and browse accounts?

Hopefully this question is not to confusing, any help is appreciated.