If a line passes through distinct points (x_1, y_1) and (x_2, y_2) then the slope of the line is given by the formula:
slope m = (Delta y)/(Delta x) = (y_2 - y_1) / (x_2 - x_1)
If the line is vertical then x_2 = x_1 so the denominator is 0.
You can mess with the numbers you are using by adding a 'number' called oo which will allow you to express the slope of a vertical line. It can be a useful shorthand, but it does not fix everything and can lead to sloppy reasoning. For example, what is the value of 0 * oo?
For a more formal approach to using oo in an advanced setting you might look at the behaviour of
f(z) = (az+b)/(cz+d)
on the Riemann sphere CC_oo. Then again, perhaps that's something to look forward to in a few years time.