[Gambas-user] Changing the value of a variable or object outside the class

BB adamnt42 at gmail.com
Mon Apr 17 04:53:41 CEST 2023

On 17/4/23 12:17 am, Mayost Sharon wrote:
> Hello, I hope the title is correct
> Further to the discussion:
> https://lists.gambas-basic.org/pipermail/user/2023-April/079118.html
> which ended successfully
> I have a new question related to classes
> I am trying to change a property of an object that is in class1 but I am inside class2
> Attached is the code I am trying and it does not allow access from class2 to class1
> Class 1 has an h_timer object
> I want in class 2 to change the value of h_timer.Delay
> Thanks
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----

Create a Public Sub in Class 1 thus

Public Sub SetDelay(newDelay as Integer)
     h_timer.Delay = newDelay

Then you can somehow call the method on the Class1 _object_ from any 
Class2 object.

I too am unsure it is that you are really trying to achieve here. Your 
questions seem quite illogical.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230417/b7c54c06/attachment.htm>

More information about the User mailing list