A crude but common way to charge ni-mh batteries is with a constant current of 0.1C, C being the amp-hour capacity, for 15 hours. Applying this current continously will shorten battery life. A float charge of 0.03C is often used to maintain the battery at full charge. A compliance voltage of 1.6 volts per cell is adequate. This means that for an 8.4 volt ni-mh (what is referred to as a 9V battery) there are seven 1.2 volt cells. So, to charge seven cells and have a compliance of 1.6 volts per cell a power supply of 11.2 volts or more should be used.
A current limiting resistor can be used and is calculated to provide 0.1C. Let's say the battery is an 8.4 volt Energizer NH22-175 having an amp-h capacitor of 175 mA. The 0.1C charge current is then 17.5 mA. The series resistor value is (11.2V-8.4V)/(17.5 mA) = 160 ohms. The resistor wattage should be such that if the output is shorted the resistor power dissipation specification is not exceeded. For this the short-circuit dissipation is [(11.2V)^2]/(160) = 0.78 watts. A 1 watt resistor or large should be used.
More complex methods are used to fast charge this type of battery yet not harm the battery.
I strongly suggest not to try a DIY a fast NiMH charger, especially for the "9 volts". From experience, it can get very exciting and messy.(POP! SPLAT!) If NiMH's get too hot internally when charging, it ruptures the cell dividers, you get a big electrical short, lots of smoke and caustic goo thrown around. (been there, done that, got the tee-shirt, ball cap, coffee mug, big Gulp, the tattoo AND the stiches to prove it.)
FYI: There are LiPO4's (really 10.1 volt no-load) coming in from China and the Asian Rim. BE CAREFUL!!! Use only THEIR chargers, don't leave them unattended!!! They are a fire and explosion hazard. They are fabulous for wireless mic packs, with maH ratings up there with disposable lithium batteries, some have built-in PC board protection, but consider all LiPO's a fire waiting to happen. If a seal breaks down, BANG! About a 5000* metal fire lights up. The cell phone/media player explosions/fires aren't "Urban legends". They are rare, but they happen. Two brands I've seen are "Happy Batt. Inc." and "Friendly Trading Inc.". "Happy" and "Friendly" must be the S*m's and C*stc*'s of China.