This article of mine would help you in understanding and learning on how to use Custom code:
Localization of SSRS Reports[
^]
Now, pointwise:
1) I have added a text box to header of the report, I want to assign some value to it from my variable.
You can do it via custom code or using a hidden textbox in report body and referring that as a reportitem object in your header.
2)I want to make this control visible and invisible depending on user's choice.
In Visible property of control, you can set an expression. Use it and put whatever condition you like to.
4)In page footer, I want to display page nos.
It's an inbuilt feature. Just use the Report Pages. Place a textbox and check the option when you select expressions. You can find the pagination option in it.
Try!