PowerBuilder ‘Gotcha’ – Null Messagebox
As with many methods in Powerbuilder, the ‘Messagebox’ function returns a NULL if any of the paramenters you send it are NULL. This can be problematic in your ‘defensive programming’ situations where you are informing the user of some type of error or condition. For Example:
ls_value = TRIM(data) IF Len(ls_value) > 0 THEN SELECT Max(itemCode) INTO :ls_check FROM AB_Part WHERE itemNo = :ls_value USING SQLCA; IF IsNull(ls_check) THEN Messagebox(Parent.title,"Item " + ls_check + " is not valid!~nPlease enter a valid Item Number.") RETURN 1 ELSE...
This code does not produce a messagebox since the value of ls_check is NULL thereby causing the messagebox text to be null.