RobotStudio event

Getting Data


Application Builder 5.09
PS SDK using C#
I am very new to Robot Application Builder. So I am going through the manual and trying examples that the manual gives and having some problems.
 
I have this at the top just under
public partial class Form1.
private
Controller controller = null;
private NetworkScanner scan = new NetworkScanner();
private ControllerInfoCollection controllers;
Then in Form1_Load() I have of test for scan object simaler to what your examples show except I just wanted to see if it works and am not displaying the data so I just have.

this
.scan.Scan();
controllers = scan.Controllers;

and it works.
Next I wanted to test reading data from the controller so I created an button and placed this code in it.

RapidData
rd = controller.Rapid.GetRapidData("T_Rob1", "User", "reg1");
However when I try to run it I get and error telling me
System.NullReferenceException was unhandled
Message="Object reference not set to an instance of an object."
at System.Threading.ThreadHelper.ThreadStart()
and states that I need to create a new instance of the object.
So I added this to the bottom of the Form1_load code.
controller =
new Controller(controllers[0]);
now I get and error saying:
System.ComponentModel.LicenseException was unhandled
Message="A valid license cannot be granted for the type ABB.Robotics.Controllers.Licenses.PCSdk. Contact the manufacturer of the component for more information."
Source="ABB.Robotics.Controllers"
StackTrace:
at ABB.Robotics.SplLicenseProvider.FindCallerLicenseKey(License Request request)
at ABB.Robotics.SplLicenseProvider.VerifyDesigntimeLicenses(Lic enseRequest request)
at ABB.Robotics.SplLicenseProvider.GetLicense(LicenseContext context, Type type, Object instance, Boolean allowExceptions)
at System.ComponentModel.LicenseManager.ValidateInternalRecursi ve(LicenseContext context, Type type, Object instance, Boolean allowExceptions, License& license, String& licenseKey)
at System.ComponentModel.LicenseManager.ValidateInternal(Type type, Object instance, Boolean allowExceptions, License& license)
at System.ComponentModel.LicenseManager.Validate(Type type)
at ABB.Robotics.Controllers.Licenses.PCSdk.Check()
at ABB.Robotics.Controllers.Controller..ctor(String controllerID)
at ABB.Robotics.Controllers.Controller..ctor(ControllerInfo controller)
at WindowsApplication1.Form1.Form1_Load(Object sender, EventArgs e) in C:Documents and Settingsdaryl.ARCSPECIALTIESMy DocumentsmogasWindowsApplication1WindowsApplication1Form 1.cs:line 51
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(M essage& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Mes sage& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoo pInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoo p(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at WindowsApplication1.Program.Main() in C:Documents and Settingsdaryl.ARCSPECIALTIESMy DocumentsmogasWindowsApplication1WindowsApplication1Prog ram.cs:line 17
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssem bly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
 
I also have the same error when trying to get mastership.
Can you help.
Daryl Pope

Comments

  • Search the RAB help and this forum under for the word "license" and you should information about the license references you must add to your project.
    Russell Drown