Code:
For X = 1 To 55 Step 1 Set Cmd = Nothing 'Read Text File values Input #1, MyFeatID, MyFeatX, MyFeatY, MyFeatZ, MyFeatI, MyFeatJ, MyFeatK 'Set the Cmd = to the Feature ID read out of the text file Set Cmd = Cmds.Item(MyFeatID) 'Check to see if I have the correct command ID first. If Cmd.ID = MyFeatID Then ReturnVar1 = Cmd.PutText(MyFeatX, TARG_X, 0) ReturnVar2 = Cmd.PutText(MyFeatY, TARG_Y, 0) ReturnVar3 = Cmd.PutText(MyFeatZ, TARG_Z, 0) ReturnVar4 = Cmd.PutText(MyFeatI, TARG_I, 0) ReturnVar5 = Cmd.PutText(MyFeatJ, TARG_J, 0) ReturnVar6 = Cmd.PutText(MyFeatK, TARG_K, 0) Cmd.ReDraw Else MsgBox "Feature ID: " & MyFeatID & " not matching, somethings wrong!!!" End If Next X
So I setup a test and put a bogus feature id in my text file and of course pcdmis or VB couldnt find the feature id when I tried to set the command in the code above. This makes "Cmd" = nothing, which is all cool and stuff but how do you get the VB compiler to evaluate an object that is = nothing?
This one has me stumped for now, any thoughts?
Above code will die at the beginning of the If statement if the object is not found.
I was hoping someone might know if there is a "If Exsists" function for feature IDs instead? This way I could test for the feature before trying to run the Set command code against it.
Thanks
Comment