I want to paste from clipboard with the F12 key please give some examples because i cannot uderstand any Key Remapping i have read.
12 1951
I want to paste from clipboard with the F12 key please give some examples because i cannot uderstand any Key Remapping i have read.
In the KeyDown event write something like: - if KeyCode = 123 then
-
'[your paste code]
-
end if
that should do for your application. (even then, it could have some advantages to use the KeyUp event or saving the KeyCode in a public variable and write the paste code in the KeyPress event, but that's up to what you need).
In the KeyDown event write something like: - if KeyCode = 123 then
-
'[your paste code]
-
end if
that should do for your application. (even then, it could have some advantages to use the KeyUp event or saving the KeyCode in a public variable and write the paste code in the KeyPress event, but that's up to what you need).
Thanks for your prompt reply but i am unsure about the syntax of pasting to what ever is selected , Do i use Clipboard.GetText ? if so how.
Thanks for your help :)
Gobble.
Thanks for your prompt reply but i am unsure about the syntax of pasting to what ever is selected , Do i use Clipboard.GetText ? if so how.
Thanks for your help :)
Gobble.
well, it depends on what you've selected, if its a textbox, something like:
textbox1.paste
should be enough.
Remember the keydown event occurs when the control or form has the focus and you press any key, so you'll have to write something in the controls' keydown event, that you want to have this feature.
Now, if what you want is a little program that 'remaps the keyboard' all the time, that'll probably need a Timer that read the keyboard events. But i dont think we need to complicate it if a single line: - if keycode=123 then textbox1.paste
in each textbox keydown event will do.
I want to paste from clipboard with the F12 key please give some examples because i cannot uderstand any Key Remapping i have read.
What version of VB are we dealing with? I've never heard of a Paste method on textboxes, so presumably that's a later version than what I'm using.
Also, what is that actual issue here - the pasting, or detecting the function key?
well, it depends on what you've selected, if its a textbox, something like:
textbox1.paste
should be enough.
Remember the keydown event occurs when the control or form has the focus and you press any key, so you'll have to write something in the controls' keydown event, that you want to have this feature.
Now, if what you want is a little program that 'remaps the keyboard' all the time, that'll probably need a Timer that read the keyboard events. But i dont think we need to complicate it if a single line: - if keycode=123 then textbox1.paste
in each textbox keydown event will do.
Thanks for the reply's guys,
ok ill explain it a little better basicly i am copying text from a txt file to the clipboard, Then i want to be able to paste it to any input box the mouse has selected.on.
ohh btw using VB6
Thanks Gobble.
Try something like this... - Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
-
If KeyCode = vbKeyF12 Then
-
Text1 = Clipboard.GetText
-
End If
-
End Sub
-
This is a very simple version, of course. You might want to do the work in a sub somehwre, and you may want to do different processing depending on things like whether the user has selected part of the text in the textbox.
It may also be nicer to do it from the form's KeyDown event rather than coding it individually for each textbox. But that will be slightly more complex to load, since you'd need to know which control has the focus.
Hi,
OK, First make Form's Property : KeyPreview = True.
Say When user Selects a Control and Presses "F8". you copy the contents to the selcetd Control..
Write this code in KeyUp event of the Form: -
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
-
If KeyCode = vbKeyF8 Then
-
Dim ctl As Control
-
Set ctl = Me.ActiveControl
-
If TypeOf ctl Is TextBox Then
-
ctl.text = Clipboard.GetText
-
ElseIf TypeOf ctl Is Label Then
-
ctl.Caption = Clipboard.GetText
-
End If
-
End If
-
End Sub
-
Regards
Veena
Hi,
OK, First make Form's Property : KeyPreview = True.
Say When user Selects a Control and Presses "F8". you copy the contents to the selcetd Control..
Write this code in KeyUp event of the Form: -
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
-
If KeyCode = vbKeyF8 Then
-
Dim ctl As Control
-
Set ctl = Me.ActiveControl
-
If TypeOf ctl Is TextBox Then
-
ctl.text = Clipboard.GetText
-
ElseIf TypeOf ctl Is Label Then
-
ctl.Caption = Clipboard.GetText
-
End If
-
End If
-
End Sub
-
Regards
Veena
Thank you so much guys i have learned from your examples ,Thanks for all your time in helping me much appreciated.
Gobble.
Thank you so much guys i have learned from your examples ,Thanks for all your time in helping me much appreciated.
Gobble.
Ok stuck again i got it to paste within my program's textbox but i want to be able to paste it onto anything with the Fkey.
For example . paste onto an open notepad or paste into explorer ect.
Thanks again
Gobble.
Hi,
You can code, to paste it on VB Controls, as you can tap the Events..
But, outside VB, you cant code...
use Ctrl+V.. thats all..
Regards
Veena
Hi,
You can code, to paste it on VB Controls, as you can tap the Events..
But, outside VB, you cant code...
use Ctrl+V.. thats all..
Regards
Veena
oh ok thanks :)
Gobble.
oh ok thanks :)
Gobble.
Note that you can use SendKeys to "pretend" the user pressed Ctrl-V.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Vlado |
last post by:
Hello,
I need to copy/paste image from Java application to/from the System
clipboard. On windows everything is just fine, but on Mac OS is not.
The problem is that when I transfer image to the...
|
by: semhelp |
last post by:
I am using VB.net to put a bitmap on the clipboard. MS paint and MS wordpad
recognize the bitmap on the clipboard, but openoffice Writer does not. If I
put the bitmap on the clipboard from MS...
|
by: sneffe |
last post by:
Hi, Does anyone have an example of how to paste or inserting an image into a rtf file? I have tried the following but the image is represented as a lot of weird letters and numbers
FileOpen(1,...
|
by: Just Me |
last post by:
I've seen code that copies a bmp file into a RichTextBox by first putting it
into the clipboard and then using Paste to get it into the RichtextBox. This
destroys the clipboard contents.
Is...
|
by: hamil |
last post by:
I would like to right click and select (copy )a file (or directory) name in
Windows Explorer and then paste the file (or directory) name into a text box
on a vb.net form. Can anyone explain how to...
|
by: Tim Marshall |
last post by:
In my not too successful attempts to get an OLE chart object (Graph
11.0) that has been manipulated on a form to be reproduced on a report,
I am considering the following procedure. First copy the...
|
by: Grant Smith |
last post by:
I've got an application that I can copy some text out of the
RichTextBox control. I would like to keep the formatting so I'm able
to copy it to the Clipboard with RTF formatting. I have no...
|
by: exhuma.twn |
last post by:
As many might know, windows allows to copy an image into the clipboard
by pressing the "Print Screen" button on the keyboard. Is it possible
to paste such an image from the clipboard into a "Text"...
|
by: bshul |
last post by:
Hi,
I am hoping someone knows how to finish this javascript. The script copies selected text to the windows clipboard from, for instance, a webpage. This text is a phone number. It then executes the...
|
by: monty0018 |
last post by:
Hi,
I'm writing a custom clipboard application in VB .NET 2008 similar to
Ditto (http://ditto-cp.sourceforge.net/).
I have tried targeting .NET Frameworks 2.0, 3.0, and 3.5 with the same...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |