473,405 Members | 2,141 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,405 software developers and data experts.

Drag and Drop

2
hello, i have an urgent case,
i wanna know how to drag and drop panels created dynamically inside a big panel??

here's below the code i make but it didn't work :
plz if anyone can help me ...


Expand|Select|Wrap|Line Numbers
  1.   Private WithEvents DynamicPanel As Panel
  2.     Private WithEvents user As UserCtrl
  3.     Private index As Integer
  4.  
  5.     Private Sub ToolBtn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolBtn1.Click
  6.  
  7.         Dim DynamicSplitter As New Splitter
  8.  
  9.         Me.DynamicPanel = New Panel
  10.         Me.DynamicPanel.Dock = DockStyle.Left
  11.         Me.DynamicPanel.AllowDrop = True
  12.         Me.DynamicPanel.BackColor = Color.White
  13.         DynamicSplitter.Dock = DockStyle.Right
  14.         DynamicSplitter.BackColor = Color.DarkGray
  15.         Me.DynamicPanel.Controls.Add(DynamicSplitter)
  16.  
  17.         user = New UserCtrl
  18.         user.Location = New Point(0, 10)
  19.         user.BackColor = Color.Beige
  20.         Me.DynamicPanel.Controls.Add(user)
  21.         Me.Panel1.Controls.Add(DynamicPanel)
  22.  
  23.         AddHandler Me.DynamicPanel.MouseDown, AddressOf DynamicPanel_MouseDown
  24.  
  25.         AddHandler Me.DynamicPanel.DragEnter, AddressOf DynamicPanel_DragEnter
  26.         AddHandler Me.DynamicPanel.DragDrop, AddressOf DynamicPanel_DragDrop
  27.  
  28.     End Sub
  29.  
  30.     Private Sub DynamicPanel_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DynamicPanel.MouseDown
  31.  
  32.         If e.Button = Windows.Forms.MouseButtons.Left Then
  33.             Me.DynamicPanel.DoDragDrop(Me.DynamicPanel, DragDropEffects.Move)
  34.         End If
  35.  
  36.     End Sub
  37.  
  38.     Private Sub DynamicPanel_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles DynamicPanel.DragEnter
  39.  
  40.         e.Effect = DragDropEffects.Move
  41.     End Sub
  42.  
  43.     Private Sub DynamicPanel_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles DynamicPanel.DragDrop
  44.  
  45.         Dim Pnl As Panel = CType(e.Data.GetData(GetType(Panel)), Panel) ' the result is nothing
  46.         e.Effect = e.AllowedEffect
  47.         Pnl.Location = New Point(e.X, e.Y) 'try change location here
  48.     End Sub
Jan 11 '08 #1
0 879

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: hemant_mishal | last post by:
Hi All, I am writting a java script library which will provide inter frame drag and drop operation. The more precise will be OLE drag and drop, which means only data will be transfered from frame...
0
by: Lauren Quantrell | last post by:
I'm trying to drop a file from Windows Explorer (or desktop, etc.) onto a field in Access2K and capture the full file path. I found an posting below that says this is possible but I cannot...
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== ...
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...
3
by: VB Programmer | last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2 listboxes? Thanks!
0
by: ViRi | last post by:
I am currently experimenting a bit with AxMicrosoft.MediaPlayer.Intero­p.AxWindowsMediaPlayer and so far, most has gone well. Currently, i would like to add drag-and-drop functionality to the...
1
by: Darren | last post by:
I'm trying to create a file using drag and drop. I want to be able to select a listview item drag it to the shell and create a file. Each icon in the listview represents a blob in a database. When...
0
by: RHSFSS | last post by:
Hi, I have a Drag and Drop registration problem (See http://www.thescripts.com/forum/thread434707.html for similar problem post), can anyone out thereadvise on the best solution? I have a .NET 2.0 ...
5
by: Romulo NF | last post by:
Greetings, I´m back here to show the new version of the drag & drop table columns (original script ). I´ve found some issues with the old script, specially when trying to use 2 tables with...
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: 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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
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
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...

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.