I've inherited a large VB.NET and Delphi (please don't ask, I don't know why) tool/project that's had multiple authors over the years. I have modified some code to add a new Block attribute and need to be able to check for it's existence (lack of = old drawing which requires a default value inserting), but can only find code that refers to a BlockReference. Looking at code elsewhere in this system such attempts to identify data is wrapped in a try/catch routine:
Try
strDepotID = clientDetailsBlock.Item(3).TextString
Catch ex As Exception
'If there is no Depot (old drawing) set to Weston Underwood
strDepotID = enumDepot.Weston.ToString()
End Try
But on this occasion, regardless of the exception handler, I keep getting an unhandled exception.
I'm afraid rooting around the interweb hasn't helped me on this occasion as everything refers to Block references (which I'm guessing is what my predecessors should have used). Is there a way to find out if Block.item(3) exists prior to trying to access it?