473,507 Members | 2,441 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unable to capture absolute paths with Drag and Drop


I wrote a small data processing application that writes a summary of
several hundred files. I use drag and drop on a panel (Panel1) to grab
the absolute path to each of these files. Then I begin analyzing all of
the files. I noticed (on the same machine) that some user profiles
appear to abbreviate the absolute paths to these files thus breaking my
data loading mechanism. Does anyone know how I can programmatically
change this filepath behavior?
Private Sub frm_QuickView_DragEnter(ByVal sender As Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles Panel1.DragEnter
If (e.Data.GetDataPresent(DataFormats.FileDrop)) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.None
End If
End Sub

Private Sub onTestDragDrop(ByVal sender As Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles Panel1.DragDrop

Dim fileList() As String = CType(e.Data.GetData(DataFormats.FileDrop),
String())
Me.StatusBar1.Text = "Loading Session..."

M_ProcessingEngine.loadDataFiles(fileList)
End Sub

I am certianly aware of other methods of opening a group of files
however people at this company prefer the look and feel of being able
to just drag a file over the application than have to deal with
dialogs.

If anyone has suggestions they would be much appreciated

Thanks,

Jeff

Jun 2 '06 #1
3 1849
Hi Jeff,

Thank you for posting.

I have performed a test on my machine based on your code in both
VS.NET2003 and VS2005. I put a label on the form to display the paths of
the files being dragged and dropped. When the program is running, I drag
files from Windows Explorer and drop them on the panel in the form. The
label in the form does display the absolute paths of these files. The
results of the two tests in VS.NET2003 and in VS2005 come out to be the
same.

The code in my program is like the following.

Private Sub Panel1_DragDrop(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles Panel1.DragDrop
Dim fileList() As String =
CType(e.Data.GetData(DataFormats.FileDrop), String())
' display the path of the first file in the fileList
Me.Label1.Text = fileList(0)
End Sub

You have mentioned that "I noticed (on the same machine) that some user
profiles appear to abbreviate the absolute paths to these files thus
breaking my data loading mechanism. " Do you mean that in some cases the
program can capture the absolute paths of the files and in other cases
can't? Would you please give me a more detailed description on this issue?

Sincerely,
Linda Liu
Microsoft Online Community Support

================================================== ==
When responding to posts,please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
================================================== ==

Jun 5 '06 #2
Hi Linda,

Thanks for your post. Yes; in some cases the program can capture the
absolute path and in some cases it wasn't. Logging in as my self I was
always able to capture the entire path. I was also able to login under a
less privileged account that our technicians use. However, one of the
engineers I that was intended to be the main user of the software was not
able to get absolute paths. We tried running the application under each of
the three user id’s on my laptop.

The paths might normally look like this:

Absolute path:
c:\Documents and Settings\SomeUser\Desktop\data\FirstFile_2005-06-03.csv

Abbreviated path:
c:\Docume ~\SomeUser\Desktop\data\FirstFil ~.csv

Unfortunately I have not cut and paste this abbreviated path as I don’t have
access to an account that experiences this problem. But I remember it
having ‘~’ making it look like old dos paths before you could exceed 8
character file names. But I don’t believe I counted the characters. The
three machines that I tested this on were all running windows XP. The only
thing different was the user id that was logged in. I figured there must be
some user profile setting that allowed it to abbreviate the paths. Or maybe
there is something in the framework that would allow me to expand the
abbreviated paths? I originally had this problem back in June of 2005 but it
still hasn’t been resolved. I wrote the application using VS2003.
Thanks,
Jeff
"Linda Liu [MSFT]" wrote:
Hi Jeff,

Thank you for posting.

I have performed a test on my machine based on your code in both
VS.NET2003 and VS2005. I put a label on the form to display the paths of
the files being dragged and dropped. When the program is running, I drag
files from Windows Explorer and drop them on the panel in the form. The
label in the form does display the absolute paths of these files. The
results of the two tests in VS.NET2003 and in VS2005 come out to be the
same.

The code in my program is like the following.

Private Sub Panel1_DragDrop(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles Panel1.DragDrop
Dim fileList() As String =
CType(e.Data.GetData(DataFormats.FileDrop), String())
' display the path of the first file in the fileList
Me.Label1.Text = fileList(0)
End Sub

You have mentioned that "I noticed (on the same machine) that some user
profiles appear to abbreviate the absolute paths to these files thus
breaking my data loading mechanism. " Do you mean that in some cases the
program can capture the absolute paths of the files and in other cases
can't? Would you please give me a more detailed description on this issue?

Sincerely,
Linda Liu
Microsoft Online Community Support

================================================== ==
When responding to posts,please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
================================================== ==

Jun 5 '06 #3
Hi Jeff,

Thank you for your response.

I have performed several tests on issue but I couldn't reproduce the
problem you have descriped.

I run the program under different user profiles and get the same result.
In every case, the program can get the correct absolute paths of the files
being dragged and dropped onto the program.

I will go on researching on this issue. I appreciate your patience.
Sincerely,
Linda Liu
Microsoft Online Community Support

================================================== ==
When responding to posts,please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
================================================== ==

Jun 7 '06 #4

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

Similar topics

5
4095
by: jason | last post by:
Can anyone help me find a solution to quickly working out relative paths to a folder in the root of my server... Although it easy when you go - say - two levels down: .../includes it...
2
4300
by: SamSpade | last post by:
There seems to be two ways to put things on the clipboard ( I don't mean different formats): SetClipboardData and OleSetClipboard If I want to get data off the clipboard do I care how it was put...
3
10390
by: Ajay Krishnan Thampi | last post by:
I have a slight problem implementing 'drag and drop' from a datagrid to a tree-view. I have pasted my code below. Someone please advice me on what to do...pretty blur right now. ==code== ...
0
1307
by: Chris Gill | last post by:
I'm trying to use cookieless sessions in asp.net using the InProc mode (for various reasons it is not desirable for us to use the other modes if it is possible to avoid them). My problem revolves...
6
3528
by: jojobar | last post by:
Hello, I look at the asp.net 2.0 web parts tutorial on the asp.net web site. I tried to run it under firefox browser but it did not run. If I want to use this feature in a commercial product...
2
4215
by: Seok Bee | last post by:
Dear Experts, In my web application, I am having a button to open a file located in the server. When I click on the button to view the file, I received the following error message:...
6
3144
by: Jon Slaughter | last post by:
do I have to prefix every absolute path with document root to get it to work? For some reason I thought that prefixing a path with '/' or './' with make it absolute w.r.t to document root but I...
1
1458
by: Silicon Strawberry | last post by:
Hello, When I do the following: - create a layout grid by going 'Layout' 'Insert Table'; - accept the default settings (3 x 3 grid); - drag a text box from the toolbox on the centre cell...
0
1176
by: Silicon Strawberry | last post by:
Hello, I posted this a while ago, but I haven't got a response yet. When I do the following: - create a layout grid by going 'Layout' 'Insert Table'; - accept the default settings (3 x 3...
0
7223
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
7111
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
7319
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,...
1
7031
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
7485
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
5623
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,...
1
5042
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.