V4RB NilObject question

Ruslan Zasukhin sunshine at public.kherson.ua
Sat Dec 20 20:25:09 CST 2003


on 12/20/03 8:19 PM, Hugh Justham at hugh at bullmedia.com.au wrote:

>> Hi Hugh,
>> 
>> Please check 
>> 
>> if you have call ValentinaInit() in the Application.open() event?
>> 
>> 
>>> Please help,
>>> 
>>> I am trying to access a database in an RB project
> 
> 
> Ruslan, thanks for your response
> 
> Yes I do call ValentinaInit() in the opewn event of my application class
> 
> The problem for me seems to be that if I declare mDatabase as a property of
> a class such as the application  or a window, then it doesn¹t get passed and
> I end up with a NilObject.
> 
> I started off with a Menu handler in my application class.  Previously I was
> erroring at the statement
> 
>   res = mDataBase.Create( f, 1, 32*1024 )
> 
> When I added the statement 'Mdatabase = New POSdb" before that statement it
> worked.  Mdatabase was declared as a property of the application.

But it is not enough just declare a property!

You MUST create instance of database by new of course.

> Surely it is possible to pass mDatabase to functions in other objects?

Yes of course.

> I am not familiar with the scope of properties in RB I suppose.

    Mdatabase = New POSdb

After this you can reach this app property everywhere...


-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list