Using Xojo.Core

I am trying to set the mode of a timer to “off” in a method but keep getting errors. If I comment out “Using Xojo.Core” then I can use the last example “Timer1.Mode = Timer.ModeOff” but then I get errors with the dates. I am successfully using “Timer1.Mode = Timer.ModeOff” in another method but that method doesn’t have “Using Xojo.Core”. If I am already “Using Xojo.Core” at the beginning of this method to handle some dates, how do I change the Timer1 mode to off?

Using Xojo.Core
Dim SQLDateTime As Text = DataList1.cell(0,1).ToText
Dim d1 As Date = Date.FromText(SQLDateTime)

//Calculate the difference between dates/times
Dim interval As DateInterval
interval = Date.Now - d1

Timer1.Mode = Xojo.Core.Timer.Modes.Off
Timer1.Mode = Timer.ModeOff

Shouldn’t this be Timer.Mode.Off instead of Xojo.Core.Timer.Mode.Off? You are doing the “using” and don’t need the full path.

I guess I am not sure what you mean. The last two lines of my code above are what I have tried but they don’t work. I am not using them at the same time they are what I have tried. I guess I didn’t explain that.

I am successfully using Timer.ModeOff in other methods and it works fine. Why can’t I use Timer.ModeOff in the same method where I have “Using Xojo.Core” for my dates?

https://documentation.xojo.com/index.php/Timer.ModeOff

You are mixing old framework and new framework. Is your timer a timer or a Xojo.Core.Timer?

Oh, the joys of the “new framework”. How to make even simple things as complicated as possible.

Tell me about it. I am trying to learn this and there seems to be 5 ways to do it and none of them work.
All of my timers are the kind that is dragged and dropped into the window. Not sure what that kind of timer is.

[quote=379595:@Dan Haglin]Tell me about it. I am trying to learn this and there seems to be 5 ways to do it and none of them work.
All of my timers are the kind that is dragged and dropped into the window. Not sure what that kind of timer is.[/quote]
That’s a classic timer. So the Using keyword is getting in your way. You might have luck using Global.Timer.ModeOff, but my advice is to avoid the Using keyword all together. It just confuses things.

So your Date and DateInterval classes would be declared as Xojo.Core.Date and Xojo.Core.DateInterval, respectively. Then your use Timer1.Mode = Timer.ModeOff to disable the Timer.

This double-language issue is really a mess for new users.

That’s the ticket. Thanks Beatrix for alerting me to the pitfalls of old and new framework and thanks Thom for the explanation.