The first step: check to see that the trigger wheel on the donor bike matches the Bandit's trigger wheel. Otherwise the CDI just won't work.
Step number two: check to see that the donor bike CDI doesn't need more inputs than the Bandit's wiring harness has to offer. Some CDIs from higher-performance versions of late '80s - early '90s carburetor bikes had extra inputs like a water temperature sensor input (the GSX-R400 CDI had one) and/or a throttle position sensor input (the GSX-R400SP CDI had one).
(if you came up with a donor CDI that matched the Bandit 400's trigger wheel but needed a water temperature input you'd be in luck because the Bandit 400's thermostat housing is actually the same item that Suzuki used on the GSX-R400 and GSX-R400SP, so it has the extra port for the secondary water temperature sensor, you'd just have to drill it out and tap threads into it to add the sensor. I did this modification to my fuel injection project Bandit so I could add a small radiator-bypass coolant line. Pictures of this modification are in my build thread.)