Gnostice Document Studio
.NET
PDFOne
.NET
Gnostice Document Studio
Java
PDFOne
(for Java)
Gnostice Document Studio
Delphi
eDocEngine
VCL
PDFtoolkit
VCL
StarDocs
Web APIs

Fixing The “A component named” [component name] “already exists” Error In Delphi

Hint: There is probably nothing wrong with [component name].
By V. Subhash

I spent the better part of today fixing a seemingly intractable problem in a Delphi project. The project compiled fine but refused to run. It raised an EcomponentError exception with the message “A component named btnClose already exists.”

The IDE showed nothing to be amiss. There was only one such button in the entire project group. I removed the button and the error turned its affections to another button.

I decided to give the code another look. The problem was with this line.

gtPDFEngine1 := gtPDFEngine1.Create(Nil);

It was sitting there snug as a bug in a rug. It should have been:

gtPDFEngine1 := TgtPDFEngine.Create(Nil);

Instead of creating the instance off the class name, I tried to use the instance name. I corrected my super silly mistake and there were no more run-time exceptions. This can happen if you share coding time between Visual Studio and Delphi. The autosuggest feature in Delphi 2010 brought up gtPDFEngine1 before TgtPDFEngine. Anyway, I wrote this writeup hoping it might be useful for someone.

---o0O0o---

Our .NET Developer Tools
Gnostice Document Studio .NET

Multi-format document-processing component suite for .NET developers.

PDFOne .NET

A .NET PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, and bookmark PDF documents in .NET applications.

Our Delphi/C++Builder developer tools
Gnostice Document Studio Delphi

Multi-format document-processing component suite for Delphi/C++Builder developers, covering both VCL and FireMonkey platforms.

eDocEngine VCL

A Delphi/C++Builder component suite for creating documents in over 20 formats and also export reports from popular Delphi reporting tools.

PDFtoolkit VCL

A Delphi/C++Builder component suite to edit, enhance, view, print, merge, split, encrypt, annotate, and bookmark PDF documents.

Our Java developer tools
Gnostice Document Studio Java

Multi-format document-processing component suite for Java developers.

PDFOne (for Java)

A Java PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, bookmark PDF documents in Java applications.

Our Platform-Agnostic Cloud and On-Premises APIs
StarDocs

Cloud-hosted and On-Premises REST-based document-processing and document-viewing APIs

Privacy | Legal | Feedback | Newsletter | Blog | Resellers © 2002-2024 Gnostice Information Technologies Private Limited. All rights reserved.