The electronic properties of single- and multi-walled carbon nanotubes have been investigated via transport measurements under controlled environmental conditions, and in-situ electro-mechanical measurements inside a high resolution transmission electron microscope (TEM) and scanning tunneling microscope (STM). Our transport measurements show that the electronic structure of nanotubes is exceedingly sensitive to adsorbed gases. For example, the thermoelectric power for pure vacuum annealed tubes is negative, while that for oxygen-dosed samples is positive. Similarly, the electrical resistivity for individual tubes is sensitive to chemical environment, and nanotubes form robust oxygen and other chemical sensors. The theoretical basis for these sensitivities are explored via quantum transport models. For electromechanical studies, a special nanotube manipulator has been constructed for insertion into a TEM. Individual multi-walled nanotubes have been variously manipulated. We have discovered ways to peel and sharpen individual nanotubes (much like the sharpening process of a china marker pencil), pull the central core tubes out from (and reinsert them into) the outer nanotube shells of multi-walled tubes (nanotube "telescoping"), and induce nanotube collapse of cylindrical tubes into nanotube ribbons. Similarly, boron nitride nanotubes have been synthesized and the electromechanical response characterized in bulk and individually inside the TEM.