RobotStudio event

PCSDK - "Use of possibly unassigned field" error

John Wiberg
John Wiberg ✭✭✭
edited September 2013 in Developer Tools
This discussion was a split from another topic.

Comments

  • when i write this code from pc sdk manuel then i get this error please help me?
  • Hi ertugrulkaya,

    That is a Visual Studio warning regarding a standard programming issue. It has nothing to do with the PC SDK.

    http://msdn.microsoft.com/en-us/library/vstudio/bb384216(v=vs.100).aspx

    What that is saying is that you are using a null type declaration [ToolData aTool;] but you have an IF{} surrounding the allocation/assign [aTool = (ToolData)rd.Value;] so when it reaches the row in question it doesn't know if the IF{} really happened or not. If the IF{} didn't happen you'd get an unhandled exception.

    The error would go away if you had the reading inside the IF{} or if you had an IF/ELSE scenario with an Exit if it wasn't a tooldata.