473,396 Members | 2,023 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,396 software developers and data experts.

Loading the Clipboard in .Net (i.e. how to what I used to do in VB6?)

Hey All,

In VB6, one could the following:

VB.Clipboard.SetData frmSubmit.picToolbarIcon.Image

or

LoadPicture(App.Path & MY_PIC_PATH)

I've tried the following but it does not work:

Clipboard.SetDataObject(MyApp.frmSubmit.ActiveForm .Icon.ToBitmap());

Does anyone know how to do this in .Net?

Thanks & Regards,

TC
Nov 21 '05 #1
2 1098
"T-Man" <ge**********@yahoo.com> schrieb:

Clipboard.SetDataObject(MyApp.frmSubmit.ActiveForm .Icon.ToBitmap());

Does anyone know how to do this in .Net?


Mhm... Try this:

\\\
Dim img As Image = Image.FromFile("C:\camera.bmp")
Clipboard.SetDataObject(img, True)
....
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2
Hey Herfried,

I just realized my folly!

The below works fine:

Clipboard.SetDataObject(MyApp.frmSubmit.ActiveForm .Icon.ToBitmap());

if one instantiates an instance of the form first!

MyApp.frmSubmit MyForm=new MyApp.frmSubmit();
Clipboard.SetDataObject(MyForm.Icon.ToBitmap());

Like the saying goes "Brain on vacation... please call back later."

Thanks for the assistance. Looking at your code jogged my memory.

I just haven't adjusted to the meanings of the new error messages under
..Net.

Regards,

TC
The problem is that my image is actually
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ud**************@TK2MSFTNGP10.phx.gbl...
"T-Man" <ge**********@yahoo.com> schrieb:

Clipboard.SetDataObject(MyApp.frmSubmit.ActiveForm .Icon.ToBitmap());

Does anyone know how to do this in .Net?


Mhm... Try this:

\\\
Dim img As Image = Image.FromFile("C:\camera.bmp")
Clipboard.SetDataObject(img, True)
...
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: LG | last post by:
Just have a question with regards to the clipboard, and how to read what other applications (Adobe InDesignCS) place in the clipboard. I am currently in the process of creating a booklet from a...
2
by: T-Man | last post by:
Hey All, In VB6, one could the following: VB.Clipboard.SetData frmSubmit.picToolbarIcon.Image or LoadPicture(App.Path & MY_PIC_PATH)
5
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...
7
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...
16
by: ad | last post by:
Hi, How can we get the content of clipboard with program?
7
by: Dave Booker | last post by:
My Clipboard is getting into some very confused state where I can't even clear it. No applications can access the clipboard in this state, and if I run Clipboard.Clear() I get: ...
15
by: Peter Duniho | last post by:
I'm trying to use .NET and C# to draw a metafile copied to the clipboard by another application (Word 2003 in this case, but it shouldn't matter). I naively thought that I'd be able to use the...
5
by: Sin Jeong-hun | last post by:
class Engine { Thread Worker; public event ... EngineMessage; public void Start() { Worker=new Thread(new ThreadStart(Run)); Worker.Start(); } private Run()
0
by: Curious | last post by:
I'm working on fixing the command of "Copy to Clipboard" from a data grid. The current implementation has two problems: 1) There are two extra columns copied to clipboard that are invisible...
20
by: Joe Duchtel | last post by:
Hello - I have the following code to get a bitmap from the clipboard and to save it to a *.png file ... Dim lData As IDataObject = Clipboard.GetDataObject() If...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
jinu1996
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...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.