A new construction of direct current (DC)-free error-correcting codes based on convolutional codes is proposed. The new code is constructed by selecting a proper subcode from a convolutional code composed of two different component codes. The encoder employs a Viterbi algorithm as the codeword selector so that the selected code sequences satisfy the DC constraint. A lower bound on the free distance of such codes is proposed, and a procedure for obtaining this bound is presented. A sufficient condition for these codes to have a bounded running digital sum (RDS) is proposed. Under the assumption of a simplified codeword selection algorithm, we present an upper bound on the maximum absolute value of the RDS and derive the sum variance for a given code. A new construction of standard DC-free codes, i.e., DC-free codes without error-correcting capability, is also proposed. These codes have the property that the decoder can be implemented by simple symbol-by-symbol hard decisions. Finally, under the new construction, we propose several codes that are suitable for the systems that require small sum variance and good error-correction capability.