By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,142 Members | 910 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,142 IT Pros & Developers. It's quick & easy.

I'm having problems copying persistent information to the clipboard

P: n/a
Hi Gang,
I don't know what to make of all of this, but I'm having nothing, but
trouble copying data to the clipboard which should be the easiest thing in
the world. The only systems I can get this to not crash on is my
development system w/ VB 2003 installed and Windows NT 4. My development
system is Windows 2000 Pro, but if I try using the clipboard on Win2K Pro
system that doesn't have VB 2003 installed it'll crash. The only workaround
I can think of is Windows API. Has anyone else experienced similar
problems?

'Stores the error dialog's error message

Dim strMessage As String

'Generates the error message to be delivered to the user including the
runtime's error description

'and the error's source the corresponding line of code in the program that
failed (that may not be

'returned when compiled as retail).

strMessage = "An unknown error has occurred in the " & Chr(34) & strLocation
& Chr(34) & ". The error's info is as follows:" & vbNewLine & _

"Message: [" & ex.Message & "]" & vbNewLine & _

"Source: [" & ex.Source & "]" & vbNewLine & _

"Stack: [" & ex.StackTrace & "]" & vbNewLine

'Copies the error message to clipboard

Clipboard.SetDataObject(strMessage, True)

Thanks in advance for the help,

Christian Blackburn
Nov 20 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
Hi,

I am not sure why this would crash on a machine that doesnt has
vs.net 2003 installed. First I would verify that you have the same version
of the framework installed on all the machines. Second I would put
Clipboard.SetDataObject(strMessage, True) in a try catch block to see what
error you are getting. Finally take a look at trace listeners.
http://msdn.microsoft.com/library/de...elisteners.asp

Ken
---------------
"Christian Blackburn" <Christian_Blackburn@Damn@Sp**@Hotmail.com> wrote in
message news:%2******************@TK2MSFTNGP11.phx.gbl...
Hi Gang,
I don't know what to make of all of this, but I'm having nothing, but
trouble copying data to the clipboard which should be the easiest thing in
the world. The only systems I can get this to not crash on is my
development system w/ VB 2003 installed and Windows NT 4. My development
system is Windows 2000 Pro, but if I try using the clipboard on Win2K Pro
system that doesn't have VB 2003 installed it'll crash. The only workaround I can think of is Windows API. Has anyone else experienced similar
problems?

'Stores the error dialog's error message

Dim strMessage As String

'Generates the error message to be delivered to the user including the
runtime's error description

'and the error's source the corresponding line of code in the program that
failed (that may not be

'returned when compiled as retail).

strMessage = "An unknown error has occurred in the " & Chr(34) & strLocation & Chr(34) & ". The error's info is as follows:" & vbNewLine & _

"Message: [" & ex.Message & "]" & vbNewLine & _

"Source: [" & ex.Source & "]" & vbNewLine & _

"Stack: [" & ex.StackTrace & "]" & vbNewLine

'Copies the error message to clipboard

Clipboard.SetDataObject(strMessage, True)

Thanks in advance for the help,

Christian Blackburn

Nov 20 '05 #2

P: n/a
Cor
Hi Christian,

Difficult problem of course,

But did you already try it with a something simpler string without that
newline.

Clipboard.SetDataObject("Hello World I am Christian")

Always better to test with those simple strings first.

Just a thougth.

Cor
Nov 20 '05 #3

P: n/a
"Christian Blackburn" <Christian_Blackburn@Damn@Sp**@Hotmail.com>
schrieb
Hi Gang,
I don't know what to make of all of this, but I'm having nothing,
but trouble copying data to the clipboard which should be the easiest
thing in the world. The only systems I can get this to not crash on
is my development system w/ VB 2003 installed and Windows NT 4. My
development system is Windows 2000 Pro, but if I try using the
clipboard on Win2K Pro system that doesn't have VB 2003 installed
it'll crash. The only workaround I can think of is Windows API. Has
anyone else experienced similar problems?


I tried the code without a problem on WinXP Prof. What kind of "crash" do
you get?
--
Armin

http://learn.to/quote
http://www.plig.net/nnq/nquote.html

Nov 20 '05 #4

P: n/a
Hi Armin,
Long time no talk :). Here's the error I'm getting:

"[Copy Info to Clipboard 1.17: Unknown Error]
An unknown error has occurred in the "ExecuteCommand("C:\Program Files\Copy
Info to Clipboard\Interop.Scripting.dll" /FullPath) Procedure". The error's
info is as follows:
Message: [The requested clipboard operation failed.]
Source: [System.Windows.Forms]
Stack: [ at System.Windows.Forms.Clipboard.SetDataObject(Objec t data,
Boolean copy)
at Copy_Info_to_Clipboard.App.ExecuteCommand(String strCommand_Line)]

[OK]"

When I'm calling ExecuteCommand with the /FullPath switch all that it's
going to copy is a simple string containing the path within the quotation
marks. I just can't understand how something so simple, and core to windows
functionality could be crashing.
Thanks for helping,
Christian Blackburn

"Christian Blackburn" <Christian_Blackburn@Damn@Sp**@Hotmail.com>
schrieb
Hi Gang,
I don't know what to make of all of this, but I'm having nothing,
but trouble copying data to the clipboard which should be the easiest
thing in the world. The only systems I can get this to not crash on
is my development system w/ VB 2003 installed and Windows NT 4. My
development system is Windows 2000 Pro, but if I try using the
clipboard on Win2K Pro system that doesn't have VB 2003 installed
it'll crash. The only workaround I can think of is Windows API. Has
anyone else experienced similar problems?


I tried the code without a problem on WinXP Prof. What kind of "crash" do
you get?
--
Armin

http://learn.to/quote
http://www.plig.net/nnq/nquote.html

Nov 20 '05 #5

P: n/a
Hi Ken,
Thanks for the help. Yes I did resolve to simplify things and compile the
string prior to sending it to the Clipboard.SetDataObject function. However
that didn't seem alleviate things either. I recall that in previous
versions of VB it was necessary to clear the clipboard prior to putting new
data on it. So I also tried it with/without emptying the clipboard first.
Neither method helped though. If I can't figure it out in another couple of
hours I'm just going to use the Windows API. I doubt it's going to be that
much harder to use. Hell I often find it easier to use :). I'll take a
look at tracelisteners in a minute here :).
Thanks for your help,
Christian Blackburn

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:OA*************@tk2msftngp13.phx.gbl...
Hi,

I am not sure why this would crash on a machine that doesnt has
vs.net 2003 installed. First I would verify that you have the same version of the framework installed on all the machines. Second I would put
Clipboard.SetDataObject(strMessage, True) in a try catch block to see what
error you are getting. Finally take a look at trace listeners.
http://msdn.microsoft.com/library/de...elisteners.asp
Ken
---------------
"Christian Blackburn" <Christian_Blackburn@Damn@Sp**@Hotmail.com> wrote in
message news:%2******************@TK2MSFTNGP11.phx.gbl...
Hi Gang,
I don't know what to make of all of this, but I'm having nothing, but
trouble copying data to the clipboard which should be the easiest thing in the world. The only systems I can get this to not crash on is my
development system w/ VB 2003 installed and Windows NT 4. My development system is Windows 2000 Pro, but if I try using the clipboard on Win2K Pro system that doesn't have VB 2003 installed it'll crash. The only

workaround
I can think of is Windows API. Has anyone else experienced similar
problems?

'Stores the error dialog's error message

Dim strMessage As String

'Generates the error message to be delivered to the user including the
runtime's error description

'and the error's source the corresponding line of code in the program that failed (that may not be

'returned when compiled as retail).

strMessage = "An unknown error has occurred in the " & Chr(34) &

strLocation
& Chr(34) & ". The error's info is as follows:" & vbNewLine & _

"Message: [" & ex.Message & "]" & vbNewLine & _

"Source: [" & ex.Source & "]" & vbNewLine & _

"Stack: [" & ex.StackTrace & "]" & vbNewLine

'Copies the error message to clipboard

Clipboard.SetDataObject(strMessage, True)

Thanks in advance for the help,

Christian Blackburn


Nov 20 '05 #6

P: n/a
Hi Ken,
So it looks like the trace listeners feature can be used to create a text
log of every line of code I "step through" before the crash.
Thanks again. I'll give that a try,
Christian Blackburn

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:OA*************@tk2msftngp13.phx.gbl...
Hi,

I am not sure why this would crash on a machine that doesnt has
vs.net 2003 installed. First I would verify that you have the same version of the framework installed on all the machines. Second I would put
Clipboard.SetDataObject(strMessage, True) in a try catch block to see what
error you are getting. Finally take a look at trace listeners.
http://msdn.microsoft.com/library/de...elisteners.asp
Ken
---------------
"Christian Blackburn" <Christian_Blackburn@Damn@Sp**@Hotmail.com> wrote in
message news:%2******************@TK2MSFTNGP11.phx.gbl...
Hi Gang,
I don't know what to make of all of this, but I'm having nothing, but
trouble copying data to the clipboard which should be the easiest thing in the world. The only systems I can get this to not crash on is my
development system w/ VB 2003 installed and Windows NT 4. My development system is Windows 2000 Pro, but if I try using the clipboard on Win2K Pro system that doesn't have VB 2003 installed it'll crash. The only

workaround
I can think of is Windows API. Has anyone else experienced similar
problems?

'Stores the error dialog's error message

Dim strMessage As String

'Generates the error message to be delivered to the user including the
runtime's error description

'and the error's source the corresponding line of code in the program that failed (that may not be

'returned when compiled as retail).

strMessage = "An unknown error has occurred in the " & Chr(34) &

strLocation
& Chr(34) & ". The error's info is as follows:" & vbNewLine & _

"Message: [" & ex.Message & "]" & vbNewLine & _

"Source: [" & ex.Source & "]" & vbNewLine & _

"Stack: [" & ex.StackTrace & "]" & vbNewLine

'Copies the error message to clipboard

Clipboard.SetDataObject(strMessage, True)

Thanks in advance for the help,

Christian Blackburn


Nov 20 '05 #7

P: n/a
Hi Cor,
I tried your suggestion and that fails to :). Of course I avoided the
"hello world bit", but surely the clipboard function doesn't require me to
prefix my data with "hello world" :).
I tried:
Clipboard.SetDataObject("test data", True)

End

and that too failed. I should also note that all the systems I'm testing on
are using the final .NET Framework 1.1 and never had a version prior so it's
not like there would be older and therefore possibly lingering files or
anything. I've tried Windows 2003, 98SE, and Millennium and they all fail
except Win NT 4! I sure wish 2000 Pro would work since that's my
development environment and that just doesn't make any sense.

Does anyone think it might be the VB Commenter program? I think I'll remove
that. If it works I'll be happy and need to emit a few swear words and be
done with it :).
Cheers,
Christian

"Cor" <no*@non.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi Christian,

Difficult problem of course,

But did you already try it with a something simpler string without that
newline.

Clipboard.SetDataObject("Hello World I am Christian")

Always better to test with those simple strings first.

Just a thougth.

Cor

Nov 20 '05 #8

P: n/a
"Christian Blackburn" <Christian_Blackburn@Damn@Sp**@Hotmail.com>
schrieb
Hi Armin,
Long time no talk :). Here's the error I'm getting:

"[Copy Info to Clipboard 1.17: Unknown Error]
An unknown error has occurred in the "ExecuteCommand("C:\Program
Files\Copy Info to Clipboard\Interop.Scripting.dll" /FullPath)
Procedure". The error's info is as follows:
Message: [The requested clipboard operation failed.]
Source: [System.Windows.Forms]
Stack: [ at System.Windows.Forms.Clipboard.SetDataObject(Objec t
data, Boolean copy)
at Copy_Info_to_Clipboard.App.ExecuteCommand(String
strCommand_Line)]

[OK]"

When I'm calling ExecuteCommand with the /FullPath switch all that
it's going to copy is a simple string containing the path within the
quotation marks. I just can't understand how something so simple,
and core to windows functionality could be crashing.
Thanks for helping,
Christian Blackburn


Maybe I misunderstand you. Is the message above the message that you copy to
the clipboard by code, or is it the message you get when trying to copy a
message to the clipboard? Means: Are you looking for the source and cause of
the exception or are you trying to fix the error while trying to copy the
exception text to the clipboard?
--
Armin

Nov 20 '05 #9

P: n/a
Cor
Hi Christian

I made this window form program with one textbox on it.
\\\
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles MyBase.Load
Dim strMessage As String = "An unknown error has occurred with " & Chr(34) &
"Christan"
Clipboard.SetDataObject(strMessage, True)
End Sub
////
This did run on a computer without VS.studio

And showed the text in the textbox after pasting

Success

Cor
Nov 20 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.