Hi guys, I have a little question (hope it's not dumb) ;-)
I have a form, containing a TreeView, say TreeView1, I want to to add a
file to the tree:
Sub AddFile(ByVal MyFile As System.IO.FileI nfo)
Dim t As New TreeNode(MyFile .Name)
Me.TreeView1.No des.Add(t)
End Sub
and I want to have the File (File Name / FileInfo, I guess would both
be fine) from a drag drop done from Windows Explorer (or in general
from a Windows dialog).
Could you, please, show me how to attach an handler to TreeView1 in
order to get the file from the drag drop.
Thank you very much in advance.
-Pam 4 1803
Hi Cor Thank you very much for your help.
I have downloaded and taken a look at
"VB.NET How-To Create an Explorer-Style Application"
It's a very simple application which does this:
"ExplorerStyleV iewer is, as the name implies, a simpler version of the
Windows Explorer application. ExplorerStyleVi ewer makes known more file
information than DirectoryScanne r, demonstrates how to associate icons
with file types, and allows the user to run an application associated
with the file type (if an association exists) by double-clicking the
file (just like in Windows Explorer)"
doesn't do any drag drop....
Thank you anyway Cor ! . It's useful to know about those samples.
-Pam
Cor Ligthert [MVP] ha scritto: Pam,
In the 101 samples for VB 2003 is a sample How to create an explorer style Application.
http://www.microsoft.com/downloads/d...displaylang=en
Probably is in that all you ask.
I hope this helps,
Cor
Thanks you Cmm. I just tried it.
I can't believe! it does work and it's so simple!!
You guys are just fantastic!!
THANKS!!!
-Pam
CMM ha scritto: Set the AllowDrop property of the control to True.
In the control's DragDrop event do something like:
If e.Data.GetDataP resent(DataForm ats.FileDrop) Then Dim sFilesAry() As String = CType(e.Data.Ge tData(DataForma ts.FileDrop), String())
For i As Integer = 0 To sFilesAry.Lengt h - 1 'do something Next i End If
Also you can use the DragEnter/DragOver events to inspect the data and change the mouse pointer displayed to the user (for instance, e.Effect = DragDropEffects .Link).
<pa***********@ libero.it> wrote in message news:11******** **************@ g47g2000cwa.goo glegroups.com.. . Hi guys, I have a little question (hope it's not dumb) ;-)
I have a form, containing a TreeView, say TreeView1, I want to to add a file to the tree:
Sub AddFile(ByVal MyFile As System.IO.FileI nfo) Dim t As New TreeNode(MyFile .Name) Me.TreeView1.No des.Add(t) End Sub
and I want to have the File (File Name / FileInfo, I guess would both be fine) from a drag drop done from Windows Explorer (or in general from a Windows dialog).
Could you, please, show me how to attach an handler to TreeView1 in order to get the file from the drag drop.
Thank you very much in advance.
-Pam
Set the AllowDrop property of the control to True.
In the control's DragDrop event do something like:
If e.Data.GetDataP resent(DataForm ats.FileDrop) Then
Dim sFilesAry() As String = CType(e.Data.Ge tData(DataForma ts.FileDrop),
String())
For i As Integer = 0 To sFilesAry.Lengt h - 1
'do something
Next i
End If
Also you can use the DragEnter/DragOver events to inspect the data and
change the mouse pointer displayed to the user (for instance, e.Effect =
DragDropEffects .Link).
<pa***********@ libero.it> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. . Hi guys, I have a little question (hope it's not dumb) ;-)
I have a form, containing a TreeView, say TreeView1, I want to to add a file to the tree:
Sub AddFile(ByVal MyFile As System.IO.FileI nfo) Dim t As New TreeNode(MyFile .Name) Me.TreeView1.No des.Add(t) End Sub
and I want to have the File (File Name / FileInfo, I guess would both be fine) from a drag drop done from Windows Explorer (or in general from a Windows dialog).
Could you, please, show me how to attach an handler to TreeView1 in order to get the file from the drag drop.
Thank you very much in advance.
-Pam This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Sparky |
last post by:
Does anyone know if dragging the URL from Internet Explorer and dropping it
into a text box in my own program is possible? erm ..and if so, how?
Failing that, is there some other method I can use to capture URL's to be
used in a VB6 program, without having to type the things in?
I would appreciate any help on this problem
TYIA
Graham
|
by: joe |
last post by:
I have an image database that I'd like to populate by dragging an image
off the desktop and
dropping onto a form (cut/paste would work equally as well)
Any suggestions?
Thanks,
Joe
|
by: Sin Jeong-hun |
last post by:
If FlowLayoutPanel's AutoScroll is set to true, there appears a scroll
bar on the right. Normally, users would expect the contents is scrolled
while they are dragging the scroll bar. Well, it does, but not when the
Windows's "Show window contents while dragging" is disabled. Almost all
the Windows' common coltrols scrolls the contents while dragging even
if that option is disabled. So, I think FlowLayoutPanel should behave
like other...
|
by: Geoff Jones |
last post by:
Hiya
Could anybody direct me to some examples of code to do the following:
Display a bitmap on a form which can then be moved about i.e. dragged, using
the left down button of the mouse.
Thanks in advance
Geoff
|
by: Liz |
last post by:
I need to implement dragging a borderless form by clicking/dragging on the
form surface. Using the "standard" approach (setting "CanMove" flag on
MouseDown, moving the form by the delta of the absolute mouse movement,
unsetting the "CanMove" flag on MouseUp) I am getting a lot of "jerky"
movement of the form and can't seem to get it smooth.
I also have noticed that MouseMove seems to fire even when there is no
motion of the mouse at all...
| |
by: Tull Clancey |
last post by:
Does anyone have, or can anyone suggest a URL for code to drag a control
around a form at run time? VB.Net 2003.
I have written stuff in VB6 to do this before, but a long time ago and I
don't have the code to refer to anymore.
Cheers,
Tull.
|
by: jon |
last post by:
I'm trying to have a section where people can just start dragging
files into a textbox and the full location of the file will be stored.
MS-Dos has this function built into it, and it's written in C, so it
has to work, I've built a textbox that accepts files:
hMsgBox = CreateWindowEx(WS_EX_CLIENTEDGE | WS_EX_ACCEPTFILES, "EDIT",
"",
WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL,
15, 30, 420, 20, hwnd, (HMENU)IDD_MSG_BOX, GetModuleHandle(NULL),...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |