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

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 1828
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
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
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
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
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
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
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
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
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
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
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.