473,394 Members | 1,696 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,394 software developers and data experts.

ActiveX .NET Drag&Drop control work fine in windows form not in webForm

I have create an activex Control with Visual studio 2005 and framework
2.0 in c# to add drag & drop functionality to upload multi file.
When I use it in a windows form it work fine. Infact if I select 3
files from a windows explorer and I move it in a listbox in my
activeX, I find my 3 files added in the listbox but if I use my
activeX in a web form and I select 3 file from a windows explorer in
the listBox find only 1 file the file on which the mouse is on when
the drag & drop operation begin.

I post some code..

private void listBox1_DragDrop(object sender, DragEventArgs e)
{
Array a = (Array)e.Data.GetData(DataFormats.FileDrop);

if (a != null)
{
// if i execute the activeX in a windows Form the
a.Length property value is the exact number of file that i have
selected
// if i execute the activeX in a web Form the
a.Length property value is always 1 for (int i =0 ;
i< a.Length; i++)
{ string s
= a.GetValue(i).ToString();

if (!listBox1.Items.Contains(s))
{
string filename =
System.IO.Path.GetFileName(s);
listBox1.Items.Add(filename);
}
}
}
}
Anyone knows why in web Form The value of a.Length is Always 1?

Thanks wery much
Jun 27 '08 #1
2 2620
I have create an activex Control with Visual studio 2005 and framework
I don't think that's possible so I have to assume you are talking about a
managed user control.

There's more going on here that what you are admitting to. This simply
wouldn't work as is in a web form, you'd need to tweak CAS policy. To debug
your issue, what you should do is wire a mouse down event that spits out the
number of objects. Modify your dragdrop routine to spit out the number of
objects in the array. When you run the app, if these two numbers are
different, it's a windows issue and not your issue. Otherwise, it's fixable.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
-------------------------------------------------------
"deccio" <de*********@gmail.comwrote in message
news:25**********************************@x35g2000 hsb.googlegroups.com...
I have create an activex Control with Visual studio 2005 and framework
2.0 in c# to add drag & drop functionality to upload multi file.
When I use it in a windows form it work fine. Infact if I select 3
files from a windows explorer and I move it in a listbox in my
activeX, I find my 3 files added in the listbox but if I use my
activeX in a web form and I select 3 file from a windows explorer in
the listBox find only 1 file the file on which the mouse is on when
the drag & drop operation begin.

I post some code..

private void listBox1_DragDrop(object sender, DragEventArgs e)
{
Array a = (Array)e.Data.GetData(DataFormats.FileDrop);

if (a != null)
{
// if i execute the activeX in a windows Form the
a.Length property value is the exact number of file that i have
selected
// if i execute the activeX in a web Form the
a.Length property value is always 1 for (int i =0 ;
i< a.Length; i++)
{ string s
= a.GetValue(i).ToString();

if (!listBox1.Items.Contains(s))
{
string filename =
System.IO.Path.GetFileName(s);
listBox1.Items.Add(filename);
}
}
}
}
Anyone knows why in web Form The value of a.Length is Always 1?

Thanks wery much
Jun 27 '08 #2
On 17 Mag, 04:07, "Alvin Bruney [ASP.NET MVP]" <vapor dan using hot
male spam filterwrote:
I have create an activex Control with Visual studio 2005 and framework

I don't think that's possible so I have to assume you are talking about a
managed user control.

There's more going on here that what you are admitting to. This simply
wouldn't work as is in a web form, you'd need to tweak CAS policy. To debug
your issue, what you should do is wire a mouse down event that spits out the
number of objects. Modify your dragdrop routine to spit out the number of
objects in the array. When you run the app, if these two numbers are
different, it's a windows issue and not your issue. Otherwise, it's fixable.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively onwww.lulu.com/owc$19.99
-------------------------------------------------------

"deccio" <denis.co...@gmail.comwrote in message

news:25**********************************@x35g2000 hsb.googlegroups.com...
I have create an activex Control with Visual studio 2005 and framework
2.0 in c# to add drag & drop functionality to upload multi file.
When I use it in a windows form it work fine. Infact if I select 3
files from a windows explorer and I move it in a listbox in my
activeX, I find my 3 files added in the listbox but if I use my
activeX in a web form and I select 3 file from a windows explorer in
the listBox find only 1 file the file on which the mouse is on when
the drag & drop operation begin.
I post some code..
private void listBox1_DragDrop(object sender, DragEventArgs e)
{
Array a = (Array)e.Data.GetData(DataFormats.FileDrop);
if (a != null)
{
// if i execute the activeX in a windows Form the
a.Length property value is the exact number of file that i have
selected
// if i execute the activeX in a web Form the
a.Length property value is always 1 for (int i =0 ;
i< a.Length; i++)
{ string s
= a.GetValue(i).ToString();
if (!listBox1.Items.Contains(s))
{
string filename =
System.IO.Path.GetFileName(s);
listBox1.Items.Add(filename);
}
}
}
}
Anyone knows why in web Form The value of a.Length is Always 1?
Thanks wery much
It was a cas problem. Thanks for the suggestion.
Jun 27 '08 #3

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

Similar topics

1
by: Karsten Schramm | last post by:
Hi, if I drag an Outlook.MailItem to a Windows-Explorer window a <subject>.msg file will be created. Now I try to drag & drop a mail item to my own WinForm app. Unfortunately it doesn't work....
0
by: Peter | last post by:
Hi, when i drag activeX control from toolbar to form i got error message "One or more of the types in the assembly unable to load." i reinstall framework and visual studio and problem still...
0
by: Andy | last post by:
Hi all, I'm developing an application which allows a drag and drop of files onto a ListView control. Everything works fine on my Windows XP development computer, but when i move the...
3
by: Goldwind | last post by:
Hi, I"m trying to use drag & drop of text from one text box to another but without suceess. Microsoft presented an example in "101 code samples" BUT in this example the code select and drag all...
6
by: David Anderson | last post by:
Does anyone know how to drag&drop a message with attachments from Outlook (2002 or 2003) in to a VB.Net windows form. This is really stumping me. I've spent a fair amount of time trying to find a...
1
by: Terry Olsen | last post by:
My first time using TreeViews. I have TreeView1 set up to display my directory structure just like Windows Explorer. I can drag & drop files and folders over to TreeView2. I can re-arrange the...
3
by: VB Programmer | last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2 listboxes? Thanks!
0
by: haegens | last post by:
I am making a .NET Application which has a TreeView Control in it. I have 3 levels of nodes. The toplevel is a rootnode which contains all other nodes. The second level holds one kind of nodes that...
1
by: SteveDouglas | last post by:
Hi all, I am currently writing an application in VB.NET that has a lot of controls (treeviews/listviews/labels and so forth) that represent "things" that need to be draggable from place to place,...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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.