Link to home
Start Free TrialLog in
Avatar of khalidsuhail
khalidsuhail

asked on

How can multiple values from a vb form window can be placed in clipboard and then can paste back by using function keys or shortcut keys indvidually?

I want to grab mulitple textbox values from vb window forms like copy to clipboard and want to paste back outside my application like web application. Any idea? I am using VB6.
for example I have three textbox Name, Date of birth, and ID. I want to grab from my application and paste it to web application by just pressing three different key f1 for name, f2 for DOB and f3 for id.


Thanks
Avatar of Leithauser
Leithauser

Store the text in variables like Name$, DOB$, ID$.
Store the total in a string.
S$= Name$ & " " & DOB$ & " " & ID$
Of course, you can format the text any way you like.
Use
Clipboard.SetText S$
to put this into the clipboard.
You did not specify how you want to paste it into the other application. I assume you want to just click on the appliation and then press Shift + Ins.
Does this answer your question?
Avatar of Karen
What do you mean by "web application"? Is this something you have written yourself, or do you mean a web browser? If it is a web browser, I don't think you'll be able to use f1/f2/f3 as these are mapped to other things - unless you have full control over the system and will be able to control the mapping.
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of khalidsuhail

ASKER

It doesn't matter what key we can use or combination of keys. Yes I means web application means web browser.
Let me explain once agian the senario.
I have VB application which has client data. Which we have to renter  into web application. which is duplication of work. To avoid mistake and do the job easy I want grab this data name, DOB, and ID in separate clipboard and want to paste in web application by pressing three different keys. it could be any key or key combination like CTRL+N for name, CTRL +D for DOB, CTRL+I for ID.
I have already done for one value. I press command button which place the name to clipboard. and by pressin CTRl+C , I can paste the name. But my problem is how to do it for more than one value?
Thanks for help
Private Sub Command12_Click()
Clipboard.SetText Trim(cboReceiver.Text) + " " + Trim(txtReceiverPersonOnBehalf.Text)
End Sub

Private Sub Command12_Click()
Clipboard.SetText Trim(cboReceiver.Text) + " " + Trim(txtReceiverPersonOnBehalf.Text)
End Sub

Open in new window

With my approach you wouldn't need to switch back to your form first.  You'd just go to the web form, place the cursor into the desired field, and then press the hotkey.

If you pressed Ctrl-F10 then the value from Text1 would be pasted into the current web form field.
If you pressed Ctrl-F11 then the value from Text2 would be pasted into the current web form field.
If you pressed Ctrl-F12 then the value from Text3 would be pasted into the current web form field.
So Idle Mind,
Do you have solution for it?
I am getting error for hot keys registering. How can I reset hot keys?
It's hitting one of these lines?

    MsgBox "Can not register all or one of the hotkeys CTRL+F10 ... Try other keys this key is already registered by some other running applications.", vbCritical

If another application has already registered the combination you want then you have no recourse but to pick a different key combination.

If you absolutely must trap that key combination then a different approach than hotkeys can be used...such as polling the keyboard state with a timer or by using a low level keyboard hook with WH_KEYBOARD_LL.
Hi Idle Mind,
I modify your code and it seems working but not direct method. For every field user has to press CTRL+key to placed the data in current clipboard. then he can paste in web apllication by pressing CTRL+C. Did you find any direct solution for the following senario. Is there any other way to paste ctrl+c ? SendKeys "^v", False is not working.
With my approach you wouldn't need to switch back to your form first.  You'd just go to the web form, place the cursor into the desired field, and then press the hotkey.

If you pressed Ctrl-F10 then the value from Text1 would be pasted into the current web form field.
If you pressed Ctrl-F11 then the value from Text2 would be pasted into the current web form field.
If you pressed Ctrl-F12 then the value from Text3 would be pasted into the current web form field.
Hi Idle Mind,
Thanks. I have done it with your approach and its working.