The Wanted's Nathan Sykes has urged youngsters to pursue their passions and believe in their abilities.
The advice came during a visit to a school to meet a cancer-stricken fan.
The singer-songwriter, 23, spoke to students at Barnwood Park Arts College in his home city of Gloucester as he met 12-year-old Mimi Kenworthy.
Mimi was diagnosed with osteosarcoma in 2015.
Mimi, whose last scan was clear, has had months of chemotherapy, and an above knee amputation.
Sykes' six-year-old cousin Jessica was recently given the all clear in her own cancer battle.
He has teamed up with Cancer Research UK to write a short story reflecting the strength children display when faced with a cancer diagnosis.
The musician interrupted Mimi's Design Technology class to pose for selfies and sign photographs.
He told the class, "If you want to do something enough, don't limit yourself."
Sykes said being part of The Wanted, who have been on a hiatus since 2014, had given him the confidence to go it alone as a solo artist.
"When the band decided to take a break, the natural thing for me was to continue making music because if you want to do something enough, you've got to believe you can do it."
"If you want to do something enough, don't limit yourself."
The singer is one of several celebrities, including actor David Harewood and actress Hermione Norris, who have penned short stories and poems for The Little Book Of Big Heroes which has been put together by Cancer Research UK Kids & Teens.
Sykes revealed his story, Rainbow's End, was inspired by his cousin and her twin sister and had made him "incredibly proud".
He said it was "amazing" to meet Mimi, adding it was the "cherry on the top of a really, wonderful and tasty cake".