473,395 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

I'm having problems copying persistent information to the clipboard

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
9 2101
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
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
"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
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
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
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
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
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Gey-Hong Gweon | last post by:
Is there a way to copy a PIL image to windows clipboard (as a dib image or a bitmap, I suppose)? What I would like to accomplish is to do a fast copy and paste of images from my python...
0
by: Ata | last post by:
Hello, I am trying to copy the contents of the output of SQL Reporting Services to a PowerPoint slide. For this, I am using SQL Reporting Services to obtain an IMAGE stream, which I paste to the...
4
by: buildmorelines | last post by:
I need a utility that will basically add a "Copy OnClick Event" to my right click context menu in Internet Explorer IE. I am a super newbie in javascript. The following code works for IE5, but not...
16
by: DataBard007 | last post by:
I have an Access97 application whose form contains many text boxes. What do I have to do in order to copy the contents of one of these text boxes to the clipboard? I want to do this so I can then...
8
by: John Smith | last post by:
Hi folks, I know how to place text into the user's clipboard: Clipboard.SetDataObject("My Copied Text"); but how do I place a file in there? So, if I have a file C:\test.txt, how can I place...
4
by: gordon | last post by:
Hi I hav e a smallish app that has a datagridview. A user can select some columns in the datagrid, and i have a button that i would like to use to copy the rows that are selected to the...
19
by: Jeff | last post by:
....working with visualweb.net 2005 and vb. ....trying to simply copy the contents from a textbox to the clipboard. I've looked at a large number of places on line and they give me various...
0
by: MathewJose | last post by:
Hi, I have a DatagridView in windows form.It has got a column which has some names that are populated from master table in database.Now i need to copy a set of data against these names. I...
0
by: Wayne | last post by:
This is driving me nuts. I use Ctrl C and Ctrl V a lot to copy and paste controls and/or properties. Intermittently whatever I've copied won't paste as if it's not on the clipboard. Sometimes I...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.