Click here to Skip to main content
15,904,023 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi.
I've been developing for years and have never experienced these type of problems.

This project is not running with application framework (running from main sub so maybe i must enable something manually)

1) Timers of System.Windows.Forms.Timer don't tick after enabling them (And executing the "Start" method), however, System.Timers.Timer do execute perfectly.

2) MessageBox popup OK before entering the form (before application.run) but once entered the main form messageboxes don't popup (Nor does MsgBox work)

Please help.

Thanks in advance.

E
Posted

1 solution

Your main must be decorated with a single thread Apartment Attribute like
this:
C#
[STAThread]
public static void main(string[] args)


In order for the System.Windows.Forms.Timer to work.

This might be the problem with the MessageBox also,
the UI Events don't execute with this attribute.
 
Share this answer
 
v2

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