i want to know about interfacing in vb with com and parallel ports

how to determine a port no.

i want both code and concepts

can anyone tell me
thanks