There was one made for a different train sim and it makes a big difference vs. the keyboard. I think it sends command line requests to the main DLL. Would not be ok with Trainz but maybe a similar idea might work.
If you mean a games console controller then yes. Make sure it's got a USB interface and is compatible with WinXP or Vista as appropriate. Then you map the buttons on the controller to keys on the keyboard. That's fine for DLL mode but I'm not sure if there are enough buttons to cover CAB mode.
I used my Flight Sim CH Products yoke. It has three sliders, the yoke which is not applicable and 12 buttons. The three variable controls were used for throttle, Dynamic brake, and train brake plus stuff for the buttons. USB