Whenever discussing operant conditioning it helps to speak the same language:
- Reinforcement: An action designed to increase the frequency a behaviour
- Punishment: An action designed to decrease the frequency of a behaviour
- Positive: Presence of a stimulus
- Negative: Absence of a stimulus
These terms can form four different combinations (N.B.: Examples in brackets are examples, not advice!):
- Positive reinforcement: Present a stimulus to increase the frequency of a behaviour (e.g. give a treat when the dog sits on command)
- Negative reinforcement: Remove a stimulus to increase the frequency of a behaviour (e.g. The mailman goes away after the dog barks at it)
- Positive punishment: Present a stimulus to decrease the frequency of a behaviour (e.g. hit the dog when it's urinated on the carpet)
- Negative punishment: Remove a stimulus to decrease the frequency of a behaviour (e.g. leave the room when the dog jumps up on you)
In practice, these can get muddled. For example, you making noise with the box is a stimulus designed to decrease the frequency of a behaviour, so it's technically an example of positive punishment, but if you stop the noise once the dog performs the correct behaviour, you also remove a stimulus to increase the frequency of the correct behaviour, hey presto!, negative reinforcement.
But that presupposes that there is a correct behaviour for your dog to perform. You don't specify what the undesired behaviour is, or if there is a desired alternative behaviour that you are trying to reinforce. If all you do with the noise is trying to stop him doing something, then you are providing punishment rather than negative reinforcement.
In either case, part of your problem is probably that you are only using primary reinforcers and punishers, i.e. ones that the dog doesn't need to learn. Food, for example, is a primary reinforcer. The dog knows food is a good thing without having to learn it. By extension, the noise is a primary punisher, as it is uncomfortable for the dog to hear. Secondary reinforcers and punishers, by contrast, are those that the dog has learned.
The classic example is Pavlov's bell that he would ring everytime he provided the dog with food. By consistently pairing a primary reinforcer with a stimulus, the stimulus can start to act as a secondary reinforcer. That is, the dog learns that the bell signals the arrival of food and will react accordingly.
You mention that you use the word "no" (hopefully in a stern voice, dogs are quite adept at discerning intonations) when telling your dog off, along with the noise. The "no" should act as a secondary punisher, the same way praise can work as a secondary reinforcer. But you probably failed to phase out the actual noise gradually, by starting to sometimes only say "no" but not do the noise.
The problem is that, by now, your dog has picked up on the fact that "no" with no box around means no primary punisher, i.e. the two are not related, and he, therefore, is save when it's not around.
I suggest that you open a new question describing the actual behaviour(s) that you want to discourage, and we might be better able to help you find a way using the whole spectrum of operant condition to get your dog to learn what you want it to do.