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

DragDrop

Lou
I have been trying to do something very simple for days now. I'm very
frustrated.

The following VB6 code works beautifully but how do I achieve the same in C#
It a drop target

Private Sub Text2_OLEDragDrop(Data As DataObject, Effect As Long, Button As
Integer, Shift As Integer, X As Single, Y As Single)
MyFormat = RegisterClipboardFormat("CF_MOSCtrlData")
Dim a() As Byte
a = Data.GetData(MyFormat)

MsgBox a
End Sub

I've tried for 2 days to get this to work in C# but can't
private void lstItems_DragDrop(object sender,
System.Windows.Forms.DragEventArgs e)

{

// Creates a new data format.

DataFormats.Format myFormat = DataFormats.GetFormat("CF_MOSCtrlData");

if (e.Data.GetDataPresent("CF_MOSCtrlData"))

{

//I get to here so I know there is data, BUT WHERE IS THE DATA?????? HOW DO
I GET THE DATA??????

Object item = (object)e.Data.GetData("CF_MOSCtrlData");

lstItems.Items.Add (item.ToString());

}
Nov 15 '05 #1
3 3187
Hi Lou,
I just came up with something that I think you should be aware of.
IDataObject interface provided by .NET platform is not the same IDataObject
interface you may know from COM.

You cannot retreive any data from the DataObject that need FROMATETC's
lIndex member set for example.
Thus, not all data put in the clipboard or dropped over by a not-.NET
applications can be consumed in .NET applications

--
B\rgds
100

"Lou" <lo********@comcast.net> wrote in message
news:ux**************@TK2MSFTNGP12.phx.gbl...
I have been trying to do something very simple for days now. I'm very
frustrated.

The following VB6 code works beautifully but how do I achieve the same in C# It a drop target

Private Sub Text2_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
MyFormat = RegisterClipboardFormat("CF_MOSCtrlData")
Dim a() As Byte
a = Data.GetData(MyFormat)

MsgBox a
End Sub

I've tried for 2 days to get this to work in C# but can't
private void lstItems_DragDrop(object sender,
System.Windows.Forms.DragEventArgs e)

{

// Creates a new data format.

DataFormats.Format myFormat = DataFormats.GetFormat("CF_MOSCtrlData");

if (e.Data.GetDataPresent("CF_MOSCtrlData"))

{

//I get to here so I know there is data, BUT WHERE IS THE DATA?????? HOW DO I GET THE DATA??????

Object item = (object)e.Data.GetData("CF_MOSCtrlData");

lstItems.Items.Add (item.ToString());

}

Nov 15 '05 #2
If you are happy with your VB6 code, you can make it compatible with VS.Net
using "RegAsm.exe" too found in the VS.Net folder

--
Rami Saad
Microsoft GTSC Developer support for Middle East
"Lou" <lo********@comcast.net> wrote in message
news:ux**************@TK2MSFTNGP12.phx.gbl...
I have been trying to do something very simple for days now. I'm very
frustrated.

The following VB6 code works beautifully but how do I achieve the same in C# It a drop target

Private Sub Text2_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
MyFormat = RegisterClipboardFormat("CF_MOSCtrlData")
Dim a() As Byte
a = Data.GetData(MyFormat)

MsgBox a
End Sub

I've tried for 2 days to get this to work in C# but can't
private void lstItems_DragDrop(object sender,
System.Windows.Forms.DragEventArgs e)

{

// Creates a new data format.

DataFormats.Format myFormat = DataFormats.GetFormat("CF_MOSCtrlData");

if (e.Data.GetDataPresent("CF_MOSCtrlData"))

{

//I get to here so I know there is data, BUT WHERE IS THE DATA?????? HOW DO I GET THE DATA??????

Object item = (object)e.Data.GetData("CF_MOSCtrlData");

lstItems.Items.Add (item.ToString());

}

Nov 15 '05 #3
Lou
what do you mean?
"Rami Saad" <ra*******@egdsc.microsoft.com> wrote in message
news:OG**************@TK2MSFTNGP09.phx.gbl...
If you are happy with your VB6 code, you can make it compatible with VS.Net using "RegAsm.exe" too found in the VS.Net folder

--
Rami Saad
Microsoft GTSC Developer support for Middle East
"Lou" <lo********@comcast.net> wrote in message
news:ux**************@TK2MSFTNGP12.phx.gbl...
I have been trying to do something very simple for days now. I'm very
frustrated.

The following VB6 code works beautifully but how do I achieve the same
in C#
It a drop target

Private Sub Text2_OLEDragDrop(Data As DataObject, Effect As Long, Button

As
Integer, Shift As Integer, X As Single, Y As Single)
MyFormat = RegisterClipboardFormat("CF_MOSCtrlData")
Dim a() As Byte
a = Data.GetData(MyFormat)

MsgBox a
End Sub

I've tried for 2 days to get this to work in C# but can't
private void lstItems_DragDrop(object sender,
System.Windows.Forms.DragEventArgs e)

{

// Creates a new data format.

DataFormats.Format myFormat = DataFormats.GetFormat("CF_MOSCtrlData");

if (e.Data.GetDataPresent("CF_MOSCtrlData"))

{

//I get to here so I know there is data, BUT WHERE IS THE DATA?????? HOW

DO
I GET THE DATA??????

Object item = (object)e.Data.GetData("CF_MOSCtrlData");

lstItems.Items.Add (item.ToString());

}


Nov 15 '05 #4

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

Similar topics

7
by: Kate | last post by:
Hi: I have a form with a picture box and some command buttons to make certain shapes appear in the picture box. The shapes are drawn on blank UserControls added like this: 'at top of form...
10
by: KS | last post by:
I have a Button I want to pull to a Label. I want the Button visualy to move when I pull it. When I drop the button on the Label I want to test some data coming with the Button - f.ex is the...
1
by: KS | last post by:
In want to visualy drag a Button to a Label and when I depress the mousebutton on top of the label I want to show some dato from the Button in a MsgBox - that's my primary goal. I have made a...
2
by: dave | last post by:
I am wishing to drag something from the desktop to a tab of a tab control in vb.net. The dragdrop event fires when release the mouse above the tab however i am having a hard time trying to figure...
0
by: Eric St-Onge | last post by:
Hi, I need to dragdrop message items from Outlook (2002 and 2003) to my application. I successfully implemented DragDrop from Explorer to MyApp but I didnt find how to properly code...
0
by: Flack | last post by:
Hello, Is it possible to find out how many methods are listening to a certain event? For example, if a number of methods subscribed to a controls DragDrop event using +=, can I find out how many...
0
by: Gene Hubert | last post by:
Well, it seems fundamental to me anyway. Hopefully it is simple enough. The question is for when the source for the dragdrop is a different application that the target for the dragdrop. How...
3
by: Gary Dunne | last post by:
I'm writing an app that requires drag and drop operation between a ListView and a TreeView control. (The source is the ListView). During the drag drop operation I want to be able to detect the...
7
by: JohnR | last post by:
I am using dragdrop to drag and drop a custom class instance. When I drag/drop from one window to another window in the same application everything works fine. But when trying to move between the...
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: 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: 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
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...
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.