We present a formula for the number of line segments connecting points of an rectangular grid. As corollaries, we obtain formulas for the number of lines through at least points and, respectively, through exactly points of the grid. The well-known case is thus generalized. We also present recursive formulas for these numbers assuming . The well-known case is thus generalized.