In The Name of Allaah, The Most Merciful, The Bestower of Mercy.
Allaah [The Most High] said:
قَوۡلٌ۬ مَّعۡرُوفٌ۬ وَمَغۡفِرَةٌ خَيۡرٌ۬ مِّن صَدَقَةٍ۬ يَتۡبَعُهَآ أَذً۬ىۗ وَٱللَّهُ غَنِىٌّ حَلِيمٌ۬
Kind words and forgiving of faults are better than Sadaqah (charity) followed by injury. And Allah is Rich (Free of all wants) and He is Most-Forbearing. [Surah Al-Baqarah. Aayah 263]
Allaah informed (us) that kind speech- which all hearts recognize and do not reject; and forgiveness, which is to pardon the one who treated you badly-, are better than charity that is followed by harm. Kind speech is good treatment and charity through speech; and forgiveness is good treatment by way of refraining from retaliation and holding someone responsible. These are two types of good treatments. As for charity followed by harm, it is a good deed that is followed its nullifier, and there is no doubt that two good deeds are better than a good dead that is nullified. This also includes the forgiveness shown by the person when he encounters some harm and harsh behaviour from the one whom he could not fulfil his request; therefore, showing forgiveness to him would be better than giving him charity and then harming him. Speaking kindly to him, refraining [from retaliation] and forgiving him is better for you than giving him charity and then harming him.
Then Allaah [The Most High] ended this Aayah with the mention of two of His Attributes which are suitable for mention in this affair, saying: [وَٱللَّهُ غَنِىٌّ حَلِيمٌ۬- and He is Most-Forbearing].
Indeed, Allaah is not in need of you and nothing [from the benefits of] your charity reaches him, rather all the abundant good in this charity and its benefits returns to you and not to Allaah [Glorified and Exalted be He]. Therefore, how can one flaunt by way of his spending and causes harm whilst Allaah is completely not in need of it and everything else besides it. In addition to this, Allaah is forbearing because He does not hasten punishment against the one who flaunts. Allaah is completely free from need in every way and He is the One described as One with forbearance, the one who overlooks and forgives, alongside the fact that He bestows His vast [limitless] favours and ample [limitless] gifts; then how can one of you harm another person by flaunting and offending, even though what you give is little, and you are weak and poor [in the sight of Allaah]. Then Allaah said:
يَـٰٓأَيُّهَا ٱلَّذِينَ ءَامَنُواْ لَا تُبۡطِلُواْ صَدَقَـٰتِكُم بِٱلۡمَنِّ وَٱلۡأَذَىٰ كَٱلَّذِى يُنفِقُ مَالَهُ ۥ رِئَآءَ ٱلنَّاسِ وَلَا يُؤۡمِنُ بِٱللَّهِ وَٱلۡيَوۡمِ ٱلۡأَخِرِۖ فَمَثَلُهُ ۥ كَمَثَلِ صَفۡوَانٍ عَلَيۡهِ تُرَابٌ۬ فَأَصَابَهُ ۥ وَابِلٌ۬ فَتَرَڪَهُ ۥ صَلۡدً۬اۖ لَّا يَقۡدِرُونَ عَلَىٰ شَىۡءٍ۬ مِّمَّا ڪَسَبُواْۗ وَٱللَّهُ لَا يَهۡدِى ٱلۡقَوۡمَ ٱلۡكَـٰفِرِينَ
O you who believe! Do not render in vain your Sadaqah (charity) by reminders of your generosity or by injury, like him who spends his wealth to be seen of men, and he does not believe in Allah, nor in the Last Day. His likeness is the likeness of a smooth rock on which is a little dust; on it falls heavy rain which leaves it bare. They are not able to do anything with what they have earned. And Allah does not guide the disbelieving people. [Al-Baqarah 264].
This [above] Aayah necessitates that flaunting and harm nullifies the reward in charity, and it is also proof that good deeds can be nullified by evil deeds. [An Excerpt from ‘Tareequl Hijratayn pages 452-453. Slightly paraphrased]