I am working on a program that puts (say) eggs into cartons. Each carton holds 30 eggs. The user can put an egg into any carton and position they want, provided it is not already used. So I have the following code in the Form Load part of the program:
MaxCart = GetSetting("GolfBalls", "Carts", "number", 400)
MaxCart is also a Public variable.
Now when I try to enter a number in the "Carton" section, I am told that the number is too high! Here is that code:
Private Sub cmdAdd_Click()
If txtCart.Text > MaxCart Then
msgtxt = "There are only " & MaxCart & " cartons!"
msghead = "Number too high"
MsgBox msgtxt, , msghead
There is other stuff as well, but this is the offending bit. If I enter number 4, all is OK. But if I enter 5, I get the message box up. Also other numbers, like 6, 7, 8, 65, 98 etc. But number 399 is OK! So are other random numbers! I have stepped through the program, and this is where I believe the problem can only be. I even set up a text box to display MaxCart and it always says 400. Any ideas?