Android Question Abort sub call on timeout


Active Member
Licensed User
Longtime User
Hi all

I’m calling a print function from an external library and when the printer is out of paper the print sub hangs and everything freezes for 2 minutes.

Is there any way to call a sub with a timeout, let’s say, 3 seconds and after that the sub call is aborted?
I’ve tried with a timer but as soon as the sub call hangs, everything hang.

thanks in advance.


Active Member
Licensed User
Longtime User
Hi Erel,

I'm I'm using a library called USBPrint that's in the forum and works ok with a ticket usb printer I've got on a project.

I'm using this code:

Private usb_print As printdemo


usb_print.connectusb2(0x1233, 0x3221)

Dim msg As String = "Text to be printed"


It works fine until the printer gets out of paper. When it does, that "printdata" call hangs and never stop making the whole program to freeze. I was trying to find a way to "stop" it.

Upvote 0