|
-
Jan 31st, 2023, 10:35 AM
#1
Thread Starter
Addicted Member
VB.NET Perform DoubleClick on Label
Hi All - I have a form with 20-30 labels on it that I am using to trigger some other events when the label is double-clicked. It all worked fine until someone asked how a barcode scan could work along side double clicking the label directly on the computer screen. I am trying to wrap my head around this but cannot figure out exactly what I need to make this happen. So for now, I have tried creating a textbox to allow input of a barcode scan. If the scanned barcode in the text field is (in my case) "Test 1 Warning" on LostFocus then I am calling my label doubleclick event like this:
Code:
Test1_Warning_DoubleClick(Nothing, Nothing)
Trying to create this as if I was physically doubleclicking the label. I can get somewhat where I want to be, but my code will not run from my Label DoubleClick event. So my question is, how can I enter something to a textbox and have that mimic the physical doubleclick event?
Thanks
-
Jan 31st, 2023, 10:50 AM
#2
Re: VB.NET Perform DoubleClick on Label
Why you have to mimic double click?
A scanner will usually send the enter or if it is programmable (by barcode commands) any special character you set it.
Also have a look here:
https://www.vbforums.com/showthread....hlight=barcode
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Jan 31st, 2023, 10:51 AM
#3
Junior Member
Re: VB.NET Perform DoubleClick on Label
Your problem description is hard to comprehend.
It reads to me as if your Label_DoubleClick code worked fine until you now try to call the event handler of the Label_DoubleClick from a Textbox_LostFocus, which also works but broke your original Label_DoubleClick handler. - Which makes little sense to me.
 Originally Posted by mikeg71
So my question is, how can I enter something to a textbox and have that mimic the physical doubleclick event?
Usually, you don't.
Instead you write a dedicated procedure to do the actual work (process the barcode?), then call this procedure from the event handler (Label_DoubleClick).
If you need to run the same code from a different event (the new Textbox_LostFocus event handler), you simply call the very same procedure instead of messing with other event handlers.
-
Jan 31st, 2023, 11:37 AM
#4
Re: VB.NET Perform DoubleClick on Label
I agree with what sonic8 said. Calling a method is just calling a method. Calling it from two different places won't cause one to stop working, unless you changed that method by some means. At a guess, I'd say that you moved something around and lost the Handles clause on the Double Click event handler, but that's nothing more than a guess.
My usual boring signature: Nothing
 
-
Jan 31st, 2023, 05:22 PM
#5
Thread Starter
Addicted Member
Re: VB.NET Perform DoubleClick on Label
Thanks all for the replies. Basically, (Shaggy Hiker) was correct. I had changed a few things and got myself lost. It all seems to be working ok now. Thanks for your time
-
Jan 31st, 2023, 10:28 PM
#6
Re: VB.NET Perform DoubleClick on Label
Please use the Thread Tools menu to mark your thread Resolved. That way, we can see that you no longer need help without opening the thread and reading the whole thing.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|