[Gambas-user] Strange behaviour using gb.settings in a component

Benoit Minisini gambas at ...1...
Wed Dec 24 13:35:38 CET 2008


On mercredi 24 décembre 2008, gambas at ...1938... wrote:
> Hi List,
>
> perhaps a silly question, but here it is:
> In my component I do:
> ' Gambas module file
> Export
> Private hCFG As Settings
>
> Public Sub _init()
>   hCFG = New Settings(User.Home &/ "projekte/gambas/xyz.cfg")
> End
>
> After that I have defined my public functions.
> xyz.cfg holds some connection parameters which are only used by the
> component itself.
>
> When I execute my component directly, everything is fine!!!!!
> When calling a function of this component from my application like this:
> ' Gambas module file
> Private ABC As New Modxyz
>
> Public Sub Main()
>   Print ABC.SomeFunction
> End
>
> and executiong the app in the IDE, I get:
> Syntax error in settings file at line #6: Connot load class 'Main'. Unable
> to load class file.
>
> In the meanwhile I checked out the following:
> When I comment out
>    hCFG = New Settings(User.Home &/ "projekte/gambas/xyz.cfg")
> in the component. This error is gone...certainly I have no access to my
> configfile anymore and so the component can't read its connection
> parameters.
>
> Any idea, what I have to do, so that my config file could be read, when the
> component is called from an app?
> Thanks in advance and have a merry christmas!
>
> Greetz
> Stevie
>

Please send me your project source code and your component source code.

Regards,

-- 
Benoit Minisini




More information about the User mailing list