Hello,

Right now I'm making a program for little kids that will shoot out simple math equations dealing with adding, subtracting, dividing, and multiplying. Everything is working fine except for one small problem on the subtraction part of the program.

I have this function that will create the subtraction problems:
VB Code:
  1. Public Function GetSubtraction(ByVal low As Integer, ByVal high As Integer) As String
  2.     intEqCount = intEqCount + 1
  3.     [COLOR=Red]Do
  4.         MainNum = Rand(low, high)
  5.     Loop Until MainNum <> LastMain[/COLOR]
  6.     LastMain = MainNum
  7.     Do
  8.         DoEvents
  9.         LowNum = Rand(low, high)
  10.     Loop Until LowNum < MainNum
  11.     GetSubtraction = MainNum & " - " & LowNum
  12. End Function
the code in red is supposed to make it so that the last first number of the subtraction equation is not the same as the previous one. But it does not work all the time, because sometimes I get repeats. Can someone help me out to not allow the same equation twice in a row?

thanks