dmitrybv 3 Posted 2 hours ago Hello. The following code throws an 'Invalid class typecast' exception. procedure TForm1.Button1Click(Sender: TObject); var RttiContext: TRttiContext; LType: TRttiType; ACaretPositionProp: TRttiProperty; Val: TValue; begin RttiContext := TRttiContext.Create; LType := RttiContext.GetType(TMemo); ACaretPositionProp := LType.GetProperty('CaretPosition'); Val := ACaretPositionProp.GetValue(Memo1); end; Although it shouldn't. Place a TMemo and a TButton on a Form and write the Button.OnClick event as described above. Embarcadero® RAD Studio 12 Version 29.0.53571.9782 Delphi 12 Update 2. Share this post Link to post