Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am battling with VB again I have used a timer in C# as follows
C#
NoDataAtPort = new System.Timers.Timer(100);
 NoDataAtPort.Elapsed += new ElapsedEventHandler(OnTimeOut)

In VB this is :
VB
Public NoDataAtPort = New System.Timers.Timer(100)
Public NoDataAtPort.Elapsed += New ElapsedEventHandler(OnTimeOut)


so why do I get the wiggly blue line of Doom? with the following error messages
Error	1	Option Strict On requires all variable declarations to have an 'As' clause.	C:\Users\glennp\Dropbox\RG3 VB TestRig Start\RG3 VB TestRig Start\VB Comms Tester\VB Comms Test\VB Comms Test\Form1.vb	37	12	VB Comms Test

That error appears twice a Second error, the third error is

Error	3	End of statement expected.	C:\Users\glennp\Dropbox\RG3 VB TestRig Start\RG3 VB TestRig Start\VB Comms Tester\VB Comms Test\VB Comms Test\Form1.vb	38	24	VB Comms Test


Do I need to a different declare...
Posted

1 solution

Try:
VB
Public NoDataAtPort As System.Timers.Timer = New System.Timers.Timer(100)
 
Share this answer
 
Comments
glennPattonWork3 10-Feb-14 5:26am    
Thanks I have just tried to find the answer on MSDN what happened to it?
glennPattonWork3 10-Feb-14 5:38am    
Umm how is the TimeOut Handler added, like AddHandler NoDataAtPort.TimedOut,Object as Delegate ?
OriginalGriff 10-Feb-14 5:49am    
Yes - there is an example on the MSDN page which adds the Elapsed event:
AddHandler aTimer.Elapsed, AddressOf OnTimedEvent
http://msdn.microsoft.com/en-us/library/system.timers.timer(v=vs.110).aspx
glennPattonWork3 10-Feb-14 6:01am    
Great thanks for that, what have 'they' done to MSDN I can't see to search it like I used to?
OriginalGriff 10-Feb-14 6:04am    
Dunno - how are you searching it?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900