TRISB.7=1 makes portb.7 an input

TRISB4.=1 makes portb.4 an input

TRISB.7=0 makes portb.7 an output

TRISB4.=0 makes portb.4 an output

Is this really what you want?

Ioannis