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

Ten lines of code to do drag n drop in VB.Net

I was searching through the MSDN documentation trying to figure out
how to do drag n drop and I found a sample program. The sample program
did all sorts of fancy junk like dynamically create it's user controls
etc. (pomp - is it really necessary to be so gaudy when trying to
explain a simple point?) So, realizing the state of the economy and
the period of history in which I was so unfortunately born, I spent
the next 3 or so hours weeding through the affectatious displays of
bravado and uselessly flagrant manefestations of excess (blank lines
every where in the sample code - What does "CONCISE" mean?)

When a people are showing a near complete, generally applicable, state
of chaotic ineptitude something is wrong with the system, though it
may look fine on the outside. Which is why we have UCOM
www.UCOM-ISM.com shedding light on the source of and solution for
these obvious yet completely overlooked social problems.

Anyway; I eventually was able to find the actual code that was
necessary to do drag n drop in VB.NET:

There was 500 lines of code in the sample using a ListBox control!

I was able to do the same thing in a TreeView control with 14 lines of
code?
'-------------------------------------------------------------------------------------------------------------
Protected Sub TreeView1_MouseMove(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles TreeView1.MouseMove
Dim sNodePathStr As String
sNodePathStr = LinkTree.SelectedNode.FullPath()
Dim dropEffect As DragDropEffects = TreeView1.DoDragDrop(sNodePathStr,
DragDropEffects.Copy)
End Sub
Private Sub TreeView1_DragOver(ByVal sender As Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles TreeView1.DragOver
e.Effect = DragDropEffects.Copy
End Sub
Private Sub TreeView1_DragDrop(ByVal sender As Object, ByVal e As
System.Windows.Forms.DragEventArgs) Handles TreeView1.DragDrop
Dim oDroppedNodePath As Object =
CType(e.Data.GetData(GetType(System.String)), System.Object)
Debug.WriteLine("Selected Item: " & CType(oDroppedNodePath, String))
oNode = LinkTree.GetNodeAt(e.X, e.Y)
Debug.WriteLine("Drop Site: " & oNode.FullPath)
End Class
'-------------------------------------------------------------------------------------------------------------
Nov 22 '05 #1
0 826

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

Similar topics

1
by: James Allen Bressem | last post by:
- hehe - When you're explaining every angle of a socio economic scenario in the context of a review of current technical issues it can take a little time to get it right - slibS, slibW, slibD (so...
6
by: James Allen Bressem | last post by:
I was searching through the MSDN documentation trying to figure out how to do drag n drop and I found a sample program. The sample program did all sorts of fancy junk like dynamically create it's...
0
by: James Allen Bressem | last post by:
Do drag n drop in VB.Net in ten lines of code - (too easy) I was searching through the MSDN documentation trying to figure out how to do drag n drop and I found a sample program. The sample...
2
by: James Allen Bressem | last post by:
- hehe - When you're explaining every angle of a socio economic scenario in the context of a review of current technical issues it can take a little time to get it right - slibS, slibW, slibD (so...
1
by: James Allen Bressem | last post by:
- hehe - When you're explaining every angle of a socio economic scenario in the context of a review of current technical issues it can take a little time to get it right - slibS, slibW, slibD (so...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?

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.