Connecting Tech Pros Worldwide Forums | Help | Site Map

Wanted neat / experienced coder :)

Needs Regular Fix
 
Join Date: Mar 2008
Posts: 283
#1: Sep 23 '08
I have a project that I have been playing with and I could really do with somebody who has time to spare to look through my code and suggest how I could have tidied up some of the lengthy code ( mainly if statements )

the project is nothing major as is supposed to be a little timer that stays topmost on my screen and changes colour according to the closeness of four alarm times and is supposed to help me at work to monitor the closeness of breaks as I easily get lost doing things and miss the breaks

some things have been changed into functions and are neater but others I could not work out how to tidy up

unfortunately no monetary prize awaits any volunteers but I will really appreciate any pointers I can get

example code below -

Expand|Select|Wrap|Line Numbers
  1.  
  2.  Public Sub check_enabled()
  3.  
  4.         If alarmisabove(BreakTimeA._sumtime) Then
  5.             BreakTimeA._enabled = True
  6.             Timer1ToolStripMenuItem.Checked = True
  7.         Else
  8.             BreakTimeA._enabled = False
  9.             Timer1ToolStripMenuItem.Checked = False
  10.         End If
  11.  
  12.         If alarmisabove(BreakTimeB._sumtime) Then
  13.             BreakTimeB._enabled = True
  14.             Timer2ToolStripMenuItem.Checked = True
  15.         Else
  16.             BreakTimeB._enabled = False
  17.             Timer2ToolStripMenuItem.Checked = False
  18.         End If
  19.  
  20.         If alarmisabove(breakTimeC._sumtime) Then
  21.             breakTimeC._enabled = True
  22.             Timer3ToolStripMenuItem.Checked = True
  23.         Else
  24.             breakTimeC._enabled = False
  25.             Timer3ToolStripMenuItem.Checked = False
  26.         End If
  27.  
  28.         If alarmisabove(breakTimeD._sumtime) Then
  29.             breakTimeD._enabled = True
  30.             Timer4ToolStripMenuItem.Checked = True
  31.         Else
  32.             breakTimeD._enabled = False
  33.             Timer4ToolStripMenuItem.Checked = False
  34.         End If
  35.  
  36.  
  37.     End Sub
  38.  
  39.  

Reply