No, no one can give you the sample coding. The Internet is full of examples, only a
Google search[
^] away.
I strongly suggest you take one of the examples provided in the search I just give you and start implementing it. If you run into problems, by all means, come back and ask, but AFTER you read the FAQs
here[
^] and
here[
^].
No one will give you the code for your tasks, because this is not the purpose of this forum. We will help you solve your problems, once we see that you have to do so yourself and failed.
Taking into consideration all of the above, I can only downvote and report your question.