Does it help to know that button 1 is the trigger on the KOP joysticks?
Each of the joystick buttons has the number printed on it except for the trigger of course.

In that example the USB 2 joystick is opened, and button 1 (the trigger) is feed into and controls the solenoid.
If you want to use the trigger on joystick 3 instead, just change "USB 2" to "USB 3" in that example.
In normal usage you'd put all this in the same loop you use the joysticks to tank/arcade drive.