The Prince of Wales has said he is "enormously grateful" to the People's Postcode Lottery for the support it has given to his charities.
Charles was speaking at the People's Postcode Lottery (PPL) charity gala, which celebrates the work funded in Britain and internationally by the charity lottery.
Other guests at the event at Prestonfield House in Edinburgh included Sir David Attenborough, who met the Prince briefly before the gala dinner.
The event brought together representatives from charities Charles is patron of including WaterAid, the British Red Cross, National Trust for Scotland and WWF UK - which have all benefited from PPL support.
Over three years it has also donated £1.95 million to The Prince's Charities, including the 2017 award of £850,000 which was confirmed last October.
Charles, known as the Duke of Rothesay when in Scotland, said: "My own charities have benefited enormously from PPL support for which I'm enormously grateful.
"Your support has already enabled 4000 homeless people to gain life changing employment through the ready for work initiative and it has also supported my Princes Trust 'get into' programme which helps young people who have had a very difficult start in life.
"In addition, I was thrilled when it became apparent that support was being given to the work being done by the Dumfries House Trust towards the regeneration of New Cumnock in Ayrshire.
"This year, PPL will also be supporting my countryside fund assisting those in rural and often isolated communities.
"it is not just my core charities that have benefited, several of which I am patron have also been supported.
"PPL has transformed the lives of hundreds of thousands of people and benefited the environment and wildlife both in the United Kingdom and internationally.
"For all of this and so much more I can't possibly thank you enough."
The subscription lottery started in 2008 and offers players the chance to win a variety of prizes every day by entering their postcode into a prize draw.
It is owned by Dutch organisation Novamedia, said to be the world's third largest private charity donor.
Sir David Attenborough collected a cheque for £250,000 for environmental charity Fauna & Flora International, of which he has been vice-president for 37 years and a member for almost six decades.
The Planet Earth presenter said of the award: "Raising Fauna & Flora International's profile as a leading conservation organisation will enable them to further educate and encourage people, businesses and governments to behave more sustainably."
Four hundred guests, including representatives from more than 70 organisations, attended the event which aimed to raise awareness of the work being funded in Britain and internationally by players of the charity lottery.
Jo Bucci, PPL managing director said: "Players of People's Postcode Lottery have raised more than £168 million for good causes to date.
"It is special to have many of these causes attend the Gala to support each other's mission and continue to strive towards making this world a better place - for people and planet."
Other guests at the gala included soul singer Mica Paris, Jeff Brazier, Danyl Johnson, Matt Johnson and Fiona Phillips.