By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,133 Members | 1,092 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,133 IT Pros & Developers. It's quick & easy.

Unable to capture absolute paths with Drag and Drop

P: n/a

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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.