cancel
Showing results for 
Search instead for 
Did you mean: 

Stop application from terminating

0 Kudos

Can anyone please help me how would I stop PB application from terminating? e.g if we have the application open and in a screen, a field is not found, it would display message "null object reference found at line XXXX...." and the application would terminate.

Is there a way to maybe close just the screen(maybe a popup window) where termination happened and let the main window still open?

Accepted Solutions (0)

Answers (2)

Answers (2)

slachevsky
Explorer
0 Kudos

Did you try adding the

try..catch in the script?

0 Kudos

We are trying to fix the issue in whole application and adding TRY...CATCH at each place would be time consuming and test would be vast.

So we were looking for an option where we dont need to code for each instance but have a code which stops termination whenever error is triggered.

Former Member
0 Kudos

Hi,

This error indicates a scripting error because an object is referenced that does not or no longer exists, although there might be situations where you cannot be 100% certain an object will exist when you need to access or open it.


One way is to add script in the systemerror event like following example

if error.Number = 22 and error.objectevent = "wf_opensheet" then

  MessageBox("OpenSheet Error", &

"Unknown Window: " +  Mid(error.text, 21)) //special case for sheet manager.

else

  MessageBox("SystemError", &

"Number: " + string(error.number) + "~r~n" &

+ "Text: " + error.text + "~r~n" &

+ "Line: " + string(error.line) + "~r~n" &

+ "Event: " + error.objectevent + "~r~n" &

+ "Object: " + error.object + "~r~n" &

+ "WindowMenu: " + error.windowmenu)

end if

Or if there are places where it is known in advance that the operation might fail , then you can put the statement sequence within a try catch statement.

Lastely this is not the right forum to ask such questions, a better place would be the PowerBuilder Developer Center, which has a much larger number of developers as members.


http://scn.sap.com/community/developer-center/powerbuilder

Ben