Yes.
And no. Things are a little more complicated than the way you have stated them.
On a standard D/G box, you can play in any key with either one or two sharps.
Keys (commonly used in folk music) having two sharps
D major
B minor
E dorian
A mixolydian
Keys with one sharp
G major
E minor
A dorian
D mixolydian
If you have accidentals on your keyboard, you might be able to manage another couple of keys in addition to the ones listed above. (We won't get into tunes with gapped scales (missing notes) here, since this might fry your brain at this early stage
)