RobotStudio event

Error creating PC SDK manual example

Hi all

I have finished creating the example starting from chapter 5 of the PC SDK application manual but have an error concerning implementing the event handler from pg 61

 if (controllerInfo.Availability == Availability.Available)

Error 2 'System.Windows.Forms.ColumnHeader' does not contain a definition for 'Available' and no extension method 'Available' accepting a first argument of type 'System.Windows.Forms.ColumnHeader' could be found (are you missing a using directive or an assembly reference?)

Could anybody help solve this error?

thanks in advance 

Tagged:

Comments

  • Hi there,

    Well... Are you missing a using/reference?

    Here try out this sample, its BasicScanApp, built in Visual Studio 2012 with PC SDK 5.60:

     

    Rebuild it and run it and see if that works. If it does go back to your code and see over your references and your using statements.

  • Thank you John 

    Your application worked, I had the same references and still my application does not run, not to worry though I have used the example you gave me as a starting point.

    I have added a STOP button to the example and followed the PCSDK manual pg74-76 to change a RAPID bool variable from false to true:
                  
    ABB.Robotics.Controllers.RapidDomain.Bool rapidBool;
    ABB.Robotics.Controllers.RapidDomain.RapidData rd = controller.Rapid.GetRapidData("T_ROB1", "MainModule", "halt");
    rapidBool.Value = false;
    if (rd.Value is ABB.Robotics.Controllers.RapidDomain.Bool)
    {
    using (Mastership m = Mastership.Request(controller.Rapid))
    {
    rd.Value = rapidBool;
    }
    }

    however I get an error 'use of unassigned local variable 'rapidBool'' 


    My RAPID module does the following:
    Move to home position
    WHILE (rapidBool=true) DO
    Path_10
    ENDWHILE
    Move to home position


    I have attached the project too.

    Many Thanks
  • Hi MechatronicsStudent,

    You get that error because rapidBool declaration doesn't include the New keyword and thus is not instantiated by the constructor. You can do that in Visual Basic where it is done behind the scenes but you cannot do that in C#. This is your line:

    ABB.Robotics.Controllers.RapidDomain.Bool rapidBool;

    That is only an empty pointer of a specifc type, it does not contain an instantiated object. This is how the line should look like:

    ABB.Robotics.Controllers.RapidDomain.Bool rapidBool = new ABB.Robotics.Controllers.RapidDomain.Bool();

    Please see this MSDN article on constructors in C#.

    http://msdn.microsoft.com/en-us/library/ace5hbzh.aspx