In Need of some C# help

I have created a form which has two buttons on it

BtnUP and BtnDown

Also on the form I have a a box two ORANGE picture boxes

PicPrevious and PicNew

The object of the program is depending on how many times that the BtnUp as been clicked and it records it in a table and the nuber of clicks that the BtnDown as been clicked once both buttons have been clicked then I would like some kind of ratio between the results of up and down clicks which say if the clicks are of a ratio of more than 4:1 then one of the orange picture boxes changes to Blue but if the ratio is less than 1:4 the colour of the picture box changes from orange to black.

If anyone as any ideas I can send you the program that i'm trying to put the code into so you get more of a understanding plus if you don't get me when i say ratio please check out

Any suggestions??


Is it the logic you're having trouble with or the C# GUI calls? A ratio can simple be expressed as a faction and thus a real number (i.e. the double data type). So 4:1 is really 4.0/1.0 = 4 and 1:4 is 1.0/4.0 = 0.25. It seems to me that you can simply keep track of the number of times each button is pressed (i.e. increment two separate variables accordingly); after you're done the incrementing, do the division as described above and you'll know which box to display. If I've misunderstood, I apologize; if you'd like a small algorithm, holla :icon_biggrin:

yes please a small algorithm would be nice. thanks.

Hehe okay I'm not sure how to describe this algorithm but of course each of your buttons will have a Click event on it - in this event you'd do the following for the up button:


Where upCount and downCount represent the number of clicks made on a button. They would be int variables. In other buttons even would be


And the method would be:

method doUpdateOfBox()
  double ratio =  upCount*1.0/downCount ;
  if (ratio > 4)
      else if (ratio < 0.25)
          else ???

I'm not sure what you're supposed to do when either of the ratios isn’t satisfied :?: For example, when both buttons have been clicked the same number of times (which would be the case initially). To avoid division by zero errors, both count variables should be initialized to 1 :icon_smile: Notice that I converted your ratios into real numbers. Does that help any?

would it possible to send you a screen shot of my program so you can see what i'm trying to achieve?? thanks for that as that helped slightly.

Is your program the same as the flash application link you provided?