"Jeff" <(E-Mail Removed)> wrote in message
news:45ac152c$0$4830$(E-Mail Removed)...
The following code works to combine client side javascript with vb.net code
to copy from a multiline textbox to the clipboard with the click of a
button.
The Javascript requires the replacement of the cursor-return/line-feeds with
\r\n and the single quotes with \'
Combining that with the clipboardData.set code and clientscript.register
code gives me code that will work to do what I want.
There probably is some more elegant way of doing this, but the entire thing
fits in 9 lines and it could have been less.
Thanks for the help.
Jeff
Protected Sub BtnCopy_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles BtnCopy.Click
Dim textboxvalue As String
textboxvalue = Replace(TextBox1.Text, vbCrLf, "\r\n")
textboxvalue = Replace(textboxvalue, "'", "\'")
Dim sb As New StringBuilder
sb.Append("<script language='JavaScript' type='text/javascript'>")
sb.Append("{clipboardData.setData('text', ")
sb.Append("'" & textboxvalue & "')}")
sb.Append("</script>")
ClientScript.RegisterClientScriptBlock(Page.GetType(), "nothing",
sb.ToString)
End Sub
--
Posted via a free Usenet account from
http://www.teranews.com