I have an aspx page on which I am trying to copy the contents of a textbox
to the client clipboard when the users clicks a button. The button code is
as follows:
=====================================
Private Sub btnCopyToClipboard_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnCopyToClipboard.Click
Clipboard.SetDataObject(txtHidden.Text)
End Sub
=================================================
When the button is clicked, I am getting the following error pointing to the
statement in the above sub.
==================================================
Exception Details: System.Threading.ThreadStateException: The current thread
must set to Single Thread Apartment (STA) mode before OLE calls can be made.
Ensure that your Main function has STAThreadAttribute marked on it.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Stack Trace:
[ThreadStateException: The current thread must set to Single Thread
Apartment (STA) mode before OLE calls can be made. Ensure that your Main
function has STAThreadAttribute marked on it.]
System.Windows.Forms.Clipboard.SetDataObject(Objec t data, Boolean copy)
+512
System.Windows.Forms.Clipboard.SetDataObject(Objec t data) +7
WBA_StaffControls.frmJudgeCommunications.btnCopyTo Clipboard_Click(Object
sender, EventArgs e) in
c:\inetpub\wwwroot\WBA_StaffControls\frmJudgeCommu nications.aspx.vb:312
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292
================================================== =======
Any thought on how to correct this problem?
Wayne 4 9165
Wayne,
Client clipboard is located on the client machine. Your code tries to set
your web server's clipboard. On client side you can use javascript
window.clipboardData object.
Eliyahu
"Wayne Wengert" <wa***********@wengert.org> wrote in message
news:ux**************@TK2MSFTNGP09.phx.gbl... I have an aspx page on which I am trying to copy the contents of a textbox to the client clipboard when the users clicks a button. The button code is as follows: ===================================== Private Sub btnCopyToClipboard_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnCopyToClipboard.Click
Clipboard.SetDataObject(txtHidden.Text)
End Sub
=================================================
When the button is clicked, I am getting the following error pointing to
the statement in the above sub.
==================================================
Exception Details: System.Threading.ThreadStateException: The current
thread must set to Single Thread Apartment (STA) mode before OLE calls can be
made. Ensure that your Main function has STAThreadAttribute marked on it.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ThreadStateException: The current thread must set to Single Thread Apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it.] System.Windows.Forms.Clipboard.SetDataObject(Objec t data, Boolean copy) +512 System.Windows.Forms.Clipboard.SetDataObject(Objec t data) +7
WBA_StaffControls.frmJudgeCommunications.btnCopyTo Clipboard_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\WBA_StaffControls\frmJudgeCommu nications.aspx.vb:312 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePo
stBackEvent(String eventArgument) +57 System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +18 System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33 System.Web.UI.Page.ProcessRequestMain() +1292
================================================== ======= Any thought on how to correct this problem? Wayne
Thanks for the quick response. Do you have a pointer to any exanples of how
to do this?
Wayne
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:Ox**************@TK2MSFTNGP09.phx.gbl... Wayne,
Client clipboard is located on the client machine. Your code tries to set your web server's clipboard. On client side you can use javascript window.clipboardData object.
Eliyahu
"Wayne Wengert" <wa***********@wengert.org> wrote in message news:ux**************@TK2MSFTNGP09.phx.gbl... I have an aspx page on which I am trying to copy the contents of a textbox to the client clipboard when the users clicks a button. The button code is as follows: ===================================== Private Sub btnCopyToClipboard_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCopyToClipboard.Click
Clipboard.SetDataObject(txtHidden.Text)
End Sub
=================================================
When the button is clicked, I am getting the following error pointing to the statement in the above sub.
==================================================
Exception Details: System.Threading.ThreadStateException: The current thread must set to Single Thread Apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ThreadStateException: The current thread must set to Single Thread Apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it.] System.Windows.Forms.Clipboard.SetDataObject(Objec t data, Boolean copy) +512 System.Windows.Forms.Clipboard.SetDataObject(Objec t data) +7 WBA_StaffControls.frmJudgeCommunications.btnCopyTo Clipboard_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\WBA_StaffControls\frmJudgeCommu nications.aspx.vb:312 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108 System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePo stBackEvent(String eventArgument) +57 System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +18 System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33 System.Web.UI.Page.ProcessRequestMain() +1292
================================================== ======= Any thought on how to correct this problem? Wayne
If you have MSDN library installed, just find "clipboardData" in the index.
Alternatively go to http://msdn.microsoft.com/library/de...pboardData.asp
You will find an example there.
Eliyahu
"Wayne Wengert" <wa***********@wengert.org> wrote in message
news:OH**************@tk2msftngp13.phx.gbl... Thanks for the quick response. Do you have a pointer to any exanples of
how to do this?
Wayne
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message news:Ox**************@TK2MSFTNGP09.phx.gbl... Wayne,
Client clipboard is located on the client machine. Your code tries to
set your web server's clipboard. On client side you can use javascript window.clipboardData object.
Eliyahu
"Wayne Wengert" <wa***********@wengert.org> wrote in message news:ux**************@TK2MSFTNGP09.phx.gbl... I have an aspx page on which I am trying to copy the contents of a textbox to the client clipboard when the users clicks a button. The button code is as follows: ===================================== Private Sub btnCopyToClipboard_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnCopyToClipboard.Click
Clipboard.SetDataObject(txtHidden.Text)
End Sub
=================================================
When the button is clicked, I am getting the following error pointing
to the statement in the above sub.
==================================================
Exception Details: System.Threading.ThreadStateException: The current thread must set to Single Thread Apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Stack Trace:
[ThreadStateException: The current thread must set to Single Thread Apartment (STA) mode before OLE calls can be made. Ensure that your
Main function has STAThreadAttribute marked on it.] System.Windows.Forms.Clipboard.SetDataObject(Objec t data, Boolean copy) +512 System.Windows.Forms.Clipboard.SetDataObject(Objec t data) +7 WBA_StaffControls.frmJudgeCommunications.btnCopyTo Clipboard_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\WBA_StaffControls\frmJudgeCommu nications.aspx.vb:312 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePo stBackEvent(String eventArgument) +57 System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +18 System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33 System.Web.UI.Page.ProcessRequestMain() +1292
================================================== ======= Any thought on how to correct this problem? Wayne
Thank you. I'll use that link and see if I can get this working.
Wayne
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:el**************@TK2MSFTNGP14.phx.gbl... If you have MSDN library installed, just find "clipboardData" in the index. Alternatively go to http://msdn.microsoft.com/library/de...pboardData.asp
You will find an example there.
Eliyahu
"Wayne Wengert" <wa***********@wengert.org> wrote in message news:OH**************@tk2msftngp13.phx.gbl... Thanks for the quick response. Do you have a pointer to any exanples of how to do this?
Wayne
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message news:Ox**************@TK2MSFTNGP09.phx.gbl... > Wayne, > > Client clipboard is located on the client machine. Your code tries to set > your web server's clipboard. On client side you can use javascript > window.clipboardData object. > > Eliyahu > > "Wayne Wengert" <wa***********@wengert.org> wrote in message > news:ux**************@TK2MSFTNGP09.phx.gbl... >> I have an aspx page on which I am trying to copy the contents of a >> textbox >> to the client clipboard when the users clicks a button. The button >> code >> is >> as follows: >> ===================================== >> Private Sub btnCopyToClipboard_Click(ByVal sender As System.Object, ByVal > e >> As System.EventArgs) Handles btnCopyToClipboard.Click >> >> Clipboard.SetDataObject(txtHidden.Text) >> >> End Sub >> >> ================================================= >> >> When the button is clicked, I am getting the following error pointing to > the >> statement in the above sub. >> >> ================================================== >> >> Exception Details: System.Threading.ThreadStateException: The current > thread >> must set to Single Thread Apartment (STA) mode before OLE calls can be > made. >> Ensure that your Main function has STAThreadAttribute marked on it. >> >> Source Error: >> >> An unhandled exception was generated during the execution of the >> current web request. Information regarding the origin and location of the >> exception can be identified using the exception stack trace below. >> >> Stack Trace: >> >> [ThreadStateException: The current thread must set to Single Thread >> Apartment (STA) mode before OLE calls can be made. Ensure that your Main >> function has STAThreadAttribute marked on it.] >> System.Windows.Forms.Clipboard.SetDataObject(Objec t data, Boolean >> copy) >> +512 >> System.Windows.Forms.Clipboard.SetDataObject(Objec t data) +7 >> > WBA_StaffControls.frmJudgeCommunications.btnCopyTo Clipboard_Click(Object >> sender, EventArgs e) in >> c:\inetpub\wwwroot\WBA_StaffControls\frmJudgeCommu nications.aspx.vb:312 >> System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108 >> > System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePo > stBackEvent(String >> eventArgument) +57 >> System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler >> sourceControl, String eventArgument) +18 >> System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) >> +33 >> System.Web.UI.Page.ProcessRequestMain() +1292 >> >> >> ================================================== ======= >> >> >> >> Any thought on how to correct this problem? >> >> >> >> Wayne >> >> > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Danny J. Lesandrini |
last post by:
Has anyone else noticed this? I searched group archives and
found nothing, but it's really starting to irritate me big time.
Here's the steps to reproduce the problem:
Copy something to the...
|
by: Shayne H |
last post by:
I am trying to write a method to copy some text to the clipboard, and leave
a copy of it there after the application has exited.
Sub CopyToClipboard(ByVal value As Object)
Dim data As New...
|
by: DraguVaso |
last post by:
Hi,
I'm looking for a way to Copy and Paste Files to the clipboard.
I found a lot of articles to copy pieces of text and bitmaps etc, but nog
whole files.
Whay I need is like you have in...
|
by: Keith |
last post by:
I'm trying to come up with a way to create a contextmenu
that will do all the "standard" functions (cut, copy,
paste, undo, etc).
There seems to be a lot of information out there - but
nothing...
|
by: lgbjr |
last post by:
Hello All,
I¡¯m using a context menu associated with some pictureboxes to provide
copy/paste functionality. Copying the image to the clipboard was easy. But
pasting an image from the clipboard...
|
by: mhospodarsky |
last post by:
Hi--
I am using VB.Net 2002 for this app. I am working with Tiff and jpeg
images. I have a picturebox set up that I use to view the images. I
have the picture box inside of a scrollable...
|
by: serge calderara |
last post by:
Dear all,
I have an treeview control with different node object, I would like to
implement the Copy/Paste function of an object . For that I am using the
folowing function to copy teh object to...
|
by: Alan T |
last post by:
Any source code example I can use to save the clipboard content to an
object, then I will do a copy and paste, finally put back the 'saved'
clipboard content back to clipboard ?
|
by: Steve |
last post by:
I'm trying to code cut, copy, and paste in vb 2005 so that when the user
clicks on a toolbar button, the cut/copy/paste will work with whatever
textbox the cursor is current located in (I have...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
| |