Quote Originally Posted by charudatt
I am facing a problem with the VB code. I cannot figure out how to program a command button (in VB6) to keep sending a stream of string when the comannd button is kept pressed. At present I can only program in a way that it sends a string only once. I have 4 command buttons for 4 direction and I am interested in Momentary action for these Command Buttons.
I did something similar for controlling a Video Conferencing camera.

Instead of using the Click event for the button....

1. Create a timer for each button and have the timer send a command each time it expires.

2. Use the MouseDown event to enable the timer

3. Use the MouseUp event to disable the timer.

The end result is that for the duration of the button press, your program will send the command every x milliseconds depending on what you set x to be.

You can get clever and include a counter as well so that you start off with one command every 200mS giving slow control but after "n" steps you decrease the time period so that the movement accellerates either gradually... 200, 190, 180, 170 etc or rapidly 200, 200, 200, 50, 50, 50 etc

Hope that helps