dotSITE
Учебник по C# Шаблоны проектирования Work in Murano Software.
новости материалы решения форумы группы настройки/о проекте

Автор: ckopn
Тема: The name 'myTimer' does not exist in the current
Дата: 7/31/2006 1:33:00 PM
пишет ошибку в функции OnTimer -> Error   1   The name 'myTimer' does not exist in the current context   D:\Visual Studio Projects\dontslouch\main.cs   31   25   dontslouch

там ведь стоят модификаторы доступа публик???

public class MessageBoxDontSlouch
   {
      public static void Main()
      {
         System.Timers.Timer myTimer = new System.Timers.Timer();
         myTimer.Elapsed += new ElapsedEventHandler(OnTimer);
         myTimer.Interval = 5000;
         myTimer.Enabled = true;
         myTimer.Start();
         while(myTimer.Enabled=true);

         myTimer.Stop();
         
      }
      public static void OnTimer(Object source, ElapsedEventArgs e)
      {
         DialogResult dr = MessageBox.Show("Сутулишься?", "Колличество: " ,MessageBoxButtons.YesNoCancel,MessageBoxIcon.Question);
         switch(dr)
         {
            case DialogResult.Yes:
if (myTimer.Interval > 5000)
myTimer.Interval = myTimer.Interval - 5000;
break;
            case DialogResult.No:
myTimer.Interval = myTimer.Interval + 5000;
               break;
            case DialogResult.Cancel:
myTimer.Enabled = false;
               break;
         }
      }

   }
}





 C# -- Программирование на C#
 The name 'myTimer' does not exist in the current ckopn    7/31/2006 1:33:00 PM
 RE: The name 'myTimer' does not exist in the current Anonymous    7/31/2006 1:56:00 PM
 RE[2]: The name 'myTimer' does not exist in the current ckopn    7/31/2006 3:49:00 PM
 RE[3]: The name 'myTimer' does not exist in the current Anonymous    7/31/2006 3:51:00 PM


Контакт Реклама на сайте Спонсорам Веб мастерам

Лицензионное соглашение - © 2000-2012 dotSITE
Хостинг .NET предоставлен PARKING.RU
Поддержку сайта осуществляет Murano Software Inc., Offshore software development