[Gambas-user] Problem with Component.Load("gb.xml.html")

Benoit Minisini benoit.minisini at gambas-basic.org
Fri Feb 10 23:23:34 CET 2023


Le 10/02/2023 à 14:08, Claus Dietrich a écrit :
> Hi
> 
> I am currently developing a new class. It shall make use of the 
> component gb.xml.http,
> 
> but it shall only be loaded, if the target application doesn't use it 
> yet. So what I do is the
> 
> following in the _new routine of my class:
> 
> Public Sub _new()
> 
> If Not Component.IsLoaded("gb.xml.html") Then
>     Component.Load("gb.xml.html")
> Endif
> 
> ..
> 
> End
> 
> The component is definitely loaded but when I try to use it in a sub of 
> my class, i.e.
> 
> Public Sub ParseHTML(sHTML)
> 
> Dim hDoc As New HtmlDocument
> 
> ...
> 
> End
> 
> I get the error "unknown ... HtmlDocument " in line "Dim hDoc As New 
> HtmlDocument".
> 
> When I add this component to the project as usual, everything is fine.
> 
> My mistake? A bug?
> 
> Best regards
> 
> Claus
> 

The compiler only knows the classes of the components you explicitly 
check in the project property dialog.

It does not know the classes of the components you load at runtime. You 
have to declare them one by one with the "CLASS" keyword, in each source 
file where that class is used. You won't have automatic completion either.

Regards,

-- 
Benoît Minisini.



More information about the User mailing list