I don't want to sound rude or unhelpful at all but please read the available
documentation and there are lots of readily available examples both there and elsewhere on the 'net for achieving simple tasks like this. After reading the docs, feel free to ask again.