leo ochoa

leo ochoa

  • 1.6k
  • 60
  • 454

How to add item to listbox and then send email.

Jan 30 2019 11:32 PM
Good day guys, I'm a semi-intermediate here in c#. Actually, the said topic name it won't work with my codes implemented, i need some help on how to improve my timer tick procedure code as shown what I've tried below.
  1. private void timer1_Tick(object sender, EventArgs e)  
  2.       {  
  3.           statmessage();  
  4.   
  5.           int i = listBox1.SelectedItems.Count + 1;  
  6.           do  
  7.   
  8.           {  
  9.               var exp = (EItem)listBox1.Items[i];  
  10.               var timeVisible = DateTime.Now - exp.Added;  
  11.               if (timeVisible.TotalSeconds > 5)  
  12.                   if (counter == 100)  
  13.                   {  
  14.   
  15.                       SendMessage();  
  16.                       counter = counter - 1;  
  17.                       ++i;  
  18.                   }  
  19.                   else if (counter <= 0)  
  20.                   {  
  21.   
  22.                       statmessage();  
  23.                   }  
  24.   
  25.           } while (i < -1);  
  26.           }  
  27.   
  28.       }  
  29.   }   
Your feedback is highly appreciated and will help to improve the said concern, Thank you very much.

Answers (3)