Help please: Dim stp as new styledTextPrinter


I have a project that compiles without problems in RS2012R2.1 but when I try to Run it in RS2013R2 I get the following error

The constructor of this class is protected, and can only be called from within its class
Dim stp as new styledTextPrinter

Sub Paint(g As Graphics, areas() As REALbasic.Rect)

Dim stp as new styledTextPrinter
Dim MyAppPrinterSetup As PrinterSetup

End Sub

How can I fix that?



This is similar to coding dim rs as new recordset. The NEW part is superfluous. You can only get a valid StyledTextPrinter from a TextArea. You will immediately throw away the object created by “New” here, so just drop it completely.

dim stp as styledTextPrinter

Thanks Tim,
Worked fine after I dropped new.