RaiseControlAddInEvent throws NullReferenceException

wakestar
Member Posts: 207
Hi all
I have a page (runmodal = false) with a timer AddIn (freddy's) on it.
The timer triggers every second:
Everything works fine, except when I change the company or the language of the RTC.
RTC then restarts the Pages but the timer event gets raised:
this causes a Null Reference Exception and the RTC throws this error:
Microsoft Dynamics NAV
Page is not open.
OK
Which is true... but how can I avoid this situation?
I have a page (runmodal = false) with a timer AddIn (freddy's) on it.
The timer triggers every second:
OnControlAddIn(Index : Integer;Data : BigText)
Everything works fine, except when I change the company or the language of the RTC.
RTC then restarts the Pages but the timer event gets raised:
this.RaiseControlAddInEvent((int)TimerFunctions.Counter, this.count++.ToString());
this causes a Null Reference Exception and the RTC throws this error:
Microsoft Dynamics NAV
Page is not open.
OK
Which is true... but how can I avoid this situation?
0
Comments
-
Can you post the whole code of freddys timer? I had other strange behaviour like that with my addin, the problem was that i hadn't overriden the dispose method and distroyed my objects correctly!
maybe you need to do this too
EDIT: I took a look at his code (freddys) and found that he implements dispose ... :-k
EDIT2: What is TimerFunctions? I don't find this one in freddys code (here: http://blogs.msdn.com/b/freddyk/archive/2009/11/03/timer-events-on-a-page.aspx)0 -
TimerFunctions = enum .. just an Index...
Counter = 1
basically the same like:
this.RaiseControlAddInEvent(1, this.count++.ToString());0 -
btw. I had to remove the
...
Application.EnterThreadModal
Application.LeaveThreadModal
..stuff because I need the events ALWAYS fired.
Freddy's example doesn't fire events when you have a modal form open0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions