vb.net - Copy to clipboard through builtin windows function, not sefmade subroutine -


i want add “copy” button application , should enumerate lot of controls it:

if typeof activecontrol textbox ... elseif typeof activecontrol richtextbox ... elseif typeof activecontrol datagridview ... elseif typeof activecontrol webbrowser ... 

etc.

but @ same time builtin copy command, activated ctrl+c, works , copy plain text textbox , richtextbox, table dgv and, say, html table table, not "body-table-blablabla".

so, question: possible activate sort of copy clipboard (may simulate ctrl+c pressing?) when button pressed?

code like

private sub copy_button_click(byval sender system.object, _ byval e system.eventargs) handles copy_button.click      sendkeys.send("^c") end sub 

is not works. thanks.

for windows forms, can use clipboard class system.windows.forms.clipboard

clipboard.settext(yourtext) 

more information: http://msdn.microsoft.com/en-us/library/637ys738.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1


Comments