All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
Gambling is forbidden by the text of the Quran, Allaah Says (what means): {O you who have believed, indeed, intoxicants, gambling, [sacrificing on] stone alters [to other than Allaah], and divining arrows are but defilement from the work of Satan, so avoid it that you may be successful.}[Quran 90].
If company X wants to buy company Y, and the latter practises gambling, as you mentioned, then this implies that company X will practise the same activity which company Y is doing.
Therefore, it is not permissible for Mr. A to carry out a research on the said company, because by doing so, he is helping in sin and Allaah Says (what means): {And cooperate in righteousness and piety, but do not cooperate in sin and aggression.}[Quran 5:2].