Ask a Question related to ASP.NET General, Design and Development.
-
TaeHo Yoo #1
how to implement copy function in asp.net
I am trying to copy a string in a text box into clipboard and what I did
was
Imports System.Windows.Forms
and
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Clipboard.SetDataObject(TextBox1.Text, True)
End Sub
but this generates an error saying
-----------------------------------------------------
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.
-----------------------------------------------------
Any idear what this means?
Could you help me?
Thanks in advance.
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
TaeHo Yoo Guest
-
ListBox Base Class won't let me implement a LoadPostData function
When I paste in the function declaration code from the VS.NET 2003 IPostBackDataHandler Interface help page and then simply end the function, I... -
Word crashes on Copy function
Running Word 98 on G3 OS9.1. Every time I highlight text to copy or cut word will crash and I have to re-start to get it back up. Can this be... -
note 33713 added to function.copy
this function copyes a file or folder, it needs another function (ls_a): this works perfect. ... -
cdrecord copy destroyed another windows copy !!!
# cdrecord -msinfo dev=1,1,0 RAW/R16 0,221691 # cdrecord -msinfo dev=1,1,0 RAW/R16 44317,51858 what can be implied by those 2 messages ? How... -
cdrecord copy destroyed another windows NERO copy for re-writable media
# cdrecord -msinfo dev=1,1,0 RAW/R16 0,221691 # cdrecord -msinfo dev=1,1,0 RAW/R16 44317,51858 what can be implied by those 2 messages ? How... -
Marc Hoeppner #2
Re: how to implement copy function in asp.net
Hi,
you should start a new thread and make it use STA. Inside the thread you
will be able to call the Clipboard function. The problem is that certain
Windows COM objects require STA and ASP.NET by default is MTA. You also
could set the ASPCompat Mode to true which means that ASP.NET will work in
STA mode. But I would recommend it.
Best regards,
Marc Höppner
NeoGeo
"TaeHo Yoo" <yootaeho@yahoo.com> wrote in message
news:eiPuPyNUDHA.1664@TK2MSFTNGP11.phx.gbl...> I am trying to copy a string in a text box into clipboard and what I did
> was
>
> Imports System.Windows.Forms
>
> and
>
>
> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button1.Click
> Clipboard.SetDataObject(TextBox1.Text, True)
> End Sub
>
>
> but this generates an error saying
>
> -----------------------------------------------------
> 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.
> -----------------------------------------------------
>
> Any idear what this means?
> Could you help me?
>
> Thanks in advance.
>
>
> *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
> Don't just participate in USENET...get rewarded for it!
Marc Hoeppner Guest
-
TaeHo Yoo #3
Re: how to implement copy function in asp.net
Thanks for your advice.
Which way would you recommend? and how to set ASPCompat Mode to true?
If I set ASPCompat Mode to true is there any risks involved?
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
TaeHo Yoo Guest
-
Marc Hoeppner #4
Re: how to implement copy function in asp.net
I would recommend using a different thread which is set to STA. Setting the
whole ASPX process to STA has some other drawbacks, one example being
greatly reduced performance. If that is not a problem in your scenario, you
can lookup the <page...> element in MSDN, there is an attribute called
something like aspcompat that you can set on the Page
Best regards,
Marc Höppner
NeoGeo
"TaeHo Yoo" <yootaeho@yahoo.com> wrote in message
news:%23PhSpNXUDHA.1712@TK2MSFTNGP11.phx.gbl...> Thanks for your advice.
> Which way would you recommend? and how to set ASPCompat Mode to true?
> If I set ASPCompat Mode to true is there any risks involved?
>
>
> *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
> Don't just participate in USENET...get rewarded for it!
Marc Hoeppner Guest



Reply With Quote

