I would have thought that if you are going to claim your expenses to go to the AGM then you would have to declare the profit if/when sold as well, as you are claiming an expense to derive income, so you must declare that income, not sure if declaring just the Dividend would suffice.
Not advice just logic (to a degree) but I would check with an accountant or you could ring the IRD and put a hypothetical scenario to them, they may give you a straight answer or a "it depends" depends on what and see if it applies??
You can still ring them anonymously I think.