473,396 Members | 1,871 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 17 '05 #1
2 1432
"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 17 '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 17 '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...
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...
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)
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()
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: 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
0
BarryA
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...
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
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...

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.