Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Drag And Drop


Here's my project. I have 2 forms, one with a TreeView and one with a DataGrid. I have a few questions I need to have answered to make my project work properly with the overall objective being that I would like to be able to click on a cell in a DataGrid, hold down my mouse, and drag the cell's value to a TreeView where the newly created TreeView Node will have the value of the cell I just drug. Here are my questions:

1) How can I tell when and where I'm clicking on a DataGrid?
2) Once I can tell where I'm clicking, how can I get the value of the cell I'm clicking on?
3) How do I automatically create a TreeView node by dragging and dropping?
4) How do I change the cursor for these events(On mouse hold down, on drag, on let go and on let go if can't be dropped in the corresponding location?

Thanks in advance and if anyone needs any code on how to populate a tree view from a database with code and a datagrid that is searchable, with code, let me know. Thanks, Jeremy




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Drag/Drop Of A PictureBox, Keeping The Image Visible During Drag
Haya!

As the title says, I need to do what seems to me should be fairly simple. I have a number of pictureboxes each filled with a static image. I would like to add the ability for a user to drag the picturebox on to ANOTHER picturebox (this one holds a image currently selected by dropdown list). Upon drop, the box and associated dropdown box should be changed accordingly.

I only need a single integer to transfer with the drag/drop operation, as each image is keyed to a number.

Now, I am not all that familier with Drag Drop at all, much less with maintaining the image while being dragged... If anyone could point me to a good tutorial, I would be much appreciative.

Thanks!

Dave Borneman

OLE Drag && Drop (Drag From My App To Windows Explorer)
How can I set this up:
My app will display a listview in large- or small- icon format. These icons will represent files. I would like the user to be able to drag one or more of the icons from the listview and drop them into an Explorer folder (effectively, my app would be copying these files to the desired folder). I know it's probably not rocket science, but I haven't done this before. TIA for your help...

WebBrowser Drag && Drop (get Drop Filename)?
I have Form with 2 WebBrowser's ( WebBrowser1 & WebBrowser2 )

WebBrowser1 is displaying graphic images that can be dragged and dropped into WebBrowser2 but how do I find the name of the file I dragged and dropped?

I also have another related questions.

I can select multiple images in WebBrowser1 but I cannot drop them into WebBrowser2 (only one image at a time), what type of container should I use to drop multiple images into? I know it can be done because I can drag and drop the multiple images into FrontPage.

Your cryptic clues would be enormously helpful to me

Drag && Drop (without Drag!!)
Hello everybody,

Hope there is a geniues or two out there!

I can make drag & drop, from vb6, but i want to make the same
functioin without drag & drop,

I want trough code to drop a picture on a other program, the program is
designed to use drag & drop, so i ques it must be possible to do that, without use of the mouse!

Know that sounds weard, but i need that function to complete a exthange between two programs, in a handicap program.

Best regards
Kim Holzmann

Drag And Drop
Hi,
I have a picture box in my form. What i want is the user to be able to drag and drop mp3 files in that picture box from windows explorer. Once the user drops the mp3 file in that picture box I want to read the full path of that mp3 file (its original location from where it was dragged and dropped). Thanks in advance. i really need to know how to do this and any help appreciated a lot. If anyone can give me the source code that will be great!!!!
Thanks

No Drag Drop
This should be simple enough. Is there a way to disable the drag drop feature of a listview?

Some relevant settings are currently set to...
DragMode = vbManual
OLEDragMode = ccOLEDragManual
OLEDropMode = ccOLEDropManual
View = lvwIcon

I simply don't want the user dragging the images anywhere.

Edit: Nevermind, got it, sorry thanks.
OLEDragMode = ccOLEDragAutomatic
OLEDropMode = ccOLEDropNone

Drag And Drop...do I Use?
Ok I have set a command button to drag(automatic)
so i click on the button and i get an outline of the button
which means i am dragging it.

My problem is when i drop it, it disapears. I want to make it so i can drag my command button and then drop it on the form.
Can you give me a very straight forward example? thanx

Drag And Drop HELP
Hi guys,

I have been trying to get a drag and drop of 4 pictureboxes going for weeks now and without success. I have come across IcePlug tutorial about the subject which is excellent and thumbs up for these people. I have managed to modify it to get what I need. I am posting my code here.

What I need is a simple 2 pairs of picture to drag and drop. Then with a button control I check if the right pic is dropped on the right drop pic.

Yet with my lack of experience in vb.NET I cannot get it right.
Can someone please help me fix it. Thanks loads.

Drag And Drop
Hey people ,
My question is this: How can i enable to drag an e-mail from the inbox (not saved as a msg file )on to my VB6 application icon so that the appliaction starts and i get some kind of information about this e-mail,
Please help...

Drag And Drop
Has anyone used Drag-and-Drop on controls on a form?

I don't seem to have any luck and would like to bounce a few questions as to how DropHighlight and HitTest work.

Any help is appreciated.

TIA
-Jeff

Drag And Drop
Is it possible to disable the 'drag and drop' ability in Excel?

Drag And Drop
I'm making a voodoo doll game and I want to have an image box to be able to be draged and droped on top of another image box, but all I can do so far is drag the box but I can't find out how to drop it. Can anyone make up a code sample to help me? I've been at this for a while so any help would be great.

OLE Drag/drop
hi, could someone explain to me how the 'effect' thing works with OLE dragging and dropping. VB has 4 constants, move, copy, none and scroll. when i drag from another control the effect is set to 3 (im guessing this is move+copy) but if i drag from windows explorer i get 7. ive checked google but what i looked at only says theres the 4 options that VB gives me

Drag And Drop
Greetings,

I want to have a command button bring up a box in sheet one with data from sheet 3 and then be able to drag individual items from the box and drop then in cells on sheet 1. Is this posible? and would I use a list box or something like it? Thanks in advance.

Drag/drop
hi, i just found out how to drag a file into my app, now how to i drag it back out? im using a listbox for the items and i want to be able to drag an item to another listbox and into explorer. please help

I Want To Know Something About Drag'n Drop
pleaze anyone help me
i added shockwave flash component to the form
i just want to enable the user to drag drop files on this flash object
is there is a way to do?

Drag And Drop
Hi
I am writing a maths program supporting multiplication. The user can select tables from 1 to 10 and is then asked to fill in the numbers. I want to drag a number from a label. Is there any way other than to use almost 100 icons to cover all the tables? If the user drags 11 then I must have a 11.ico annd so on. Is ther a way around this.

Best wishes from Iceland

Drag, Drop
what exactly does Drag, Drop do?

Drag And Drop
I am creating a quiz for Chemistry.

I want to include an interactive atom. Where there will be a picture of an atom, 3 words at the side to represent the parts of the atom (protons, electrons, neutrons and nucleus) and spaces where the user can drag the word and put it into the space.

It should be that if the user drags and then drops the word into the correct area then ti stays there. If moved to the wring blank space then the word moves back to its original starting place.

I've been told that labels should be used for the words that have to be dragged? Adn PictureBoxes to drag the labels into?

Can anyone help? Source code would be great.

Drag && Drop Please Help !!!
Hello,

I am having problem with Drag & Drop part, for right now i have no idea what to do, i haven't done this before. I am writing a scanning module that allows scan, drag and drop of image in the image list. My Mouse Down Event looks like this (Only know how to do this event):

Private Sub LEADRasImgList1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
Dim nItem As Long

If Button <> 1 Then Exit Sub
nItem = LEADRasImgList1.HitTest(x, y)
If (nItem >= 0) Then
LEADRasImgList1.SelectionColor = RGB(255, 0, 0)
LEADRasImgList1.Item(nItem).Selected = True
End If
End Sub

Mouse Move Event (have no idea what should i put in here):

Private Sub LEADRasImgList1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)

......???????

End Sub

Private Sub LEADRasImgList1_DragOver(Source As Control, x As Single, y As Single, State As Integer)
..........????
End Sub

Private Sub LEADRasImgList1_DragDrop(Source As Control, x As Single, y As Single)

.........?????
End Sub
-------------------------------------------------------------

Could anyone please tell me what how to do this. Thanks in advance for any help

Drag And Drop Help
Hey

I'd like to know how to drag a label into a picturebox, and when it is dropped on top of the picturebox you can see the contents of the label in the picturebox. So far all i've managed to do is make the label able to be dragged only on to the picturebox, and when it is dropped on top of the picturebox, the label is made to go to the same position as the picturebox, but you can't see the label once it has been moved there.
The only code i have for the drag and drop so far is:

Private Sub Picture1_DragDrop(Source As Control, X As Single, Y As Single)
If Source = Label4 Then
Label4.Left = 600
Label4.Top = 2280
Else
End If
End Sub

Can anyone help or recommend another way to do this, perhaps not using a picturebox?

Thanks

Drag Drop
Anyone know how I can use drag and drop to drag just the selected items out of a file list box?

Drag And Drop
ok how can i drag and drop a .log into a textbox and display the file path of the file?

thanks

Drag And Drop
How do I make it so I can take a picture and make it the background and then be able to have pictures on the side that I can drag over and move to the space I want for example have a Christmas tree as the background and then make ornaments as images able to drag and drop so they can decorate the tree themselves??

Drag Drop
Code:
Private Sub ListView1_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
If Data.GetFormat(vbCFFiles) Then
For i = 1 To Data.Files.Count
ListView1.ListItems.Add , , Data.Files(i), , 3
Next i
End If
End Sub
how can you tell if the user has dropped a file or a directory other than using scripting to see if the file exsists and if not then it's a directory (which is flawed anyhow)

Drag And Drop
I have a DataGrid and I want to be able to highlight a row with my mouse click, already completed, and then take the value of the first row and first column and drag it onto a treeview where I will create a node with the value of the cell being drug. Does this make sense? Please help. Thanks, Jeremy

Drag And Drop
If any of you are familier with Hip-hop Ejay, then you know that you are able to Drag and Drop sound files, which is really a picturebox, to the tracks you wish. I was wondering how to do this?

I am making something like it, and want to drag the sound file to the tracks to place them there, they also need to 'lock into place' and thoughts would be great, thanks.

Drag && Drop?
Can anyone give me smoe code that lets me drag and drop a treeview's nodes around in VB??

Drag And Drop
Hi all, I've been having this slight problem with the drag and drop, now I wanna be able to move an object from one place of the screen to another and have it stay where I want it, I was able to do this with this coding>

Dim XX As Long, YY As Long

Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
XX = X
YY = Y
End Sub


Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
With Command1
.Move .Left - (XX - X), .Top - (YY - Y)
End With
End If
End Sub

----
but I have the inconvinience that it calls up the object every mousemove so when I click on it to move it, it leaves a trail or repetition of the object until I release it at which point it does stay where I want it to. I would like to know if there was a way which I could eliminate this trail or repetition........AND if it is possible to integrate such coding with the OLE drop mode, cause with my present coding the OLE drop mode wont work

Thanks in advance

Drag Drop
I want to set up a form where i'll be able to drag and drop a label from one place to the next.. how can i do this? Thanks

Drag && Drop
About dragDrop
If i want to Drag and drop a picture from 1 form to another... what do i have to do i set up the drag and drop option on the picture.
On the form i want to picture to be dropped i write
Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
picMap.PaintPicture Source.Picture, X, Y
End Sub
it give me an error. What does the picMap.PaintPicture mean...

and another thing i put a post with 5 easy questions to answer if you have time to spare you can answer them if your older then 21...

http://www.xtremevbtalk.com/showthre...threadid=22505

Drag And Drop
Hi I was wondering if anyone may be able to help me, I am trying to carry out a drag and drop scenario of:

I have created a usercontrol that I would like to be able to drag around a form.

In the forms drag drop event I have the following code

Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Source.Move X - modvar.Xoffset, Y - modvar.Yoffset
End Sub

in the usercontrol I have the following code

Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Modvar.Xoffset = X
Modvar.Yoffset = Y
End Sub

which provides the offsett for the from drag drop

As can be seen, the offset's are both stored and accessed from a global module modvar


The problem that I am having is that when the UserControl is on the form and moved, the Mousemove event is never being run.

What am i doing wrong
Thanks Phil

Drag And Drop Mix Up!!
help i have two sets of drag and drop items and i wish to drag and drop them on two seperate areas but they can both be dragged on to the others area. So how can i make each object to only be allowed to be dropped on one area and not the other?

object A to section A
object B to section B

not
object A to section A or section B
object B to section A or section B

thanks in advance.....

Drag And Drop
Been working on a drag and drop within my application and have found plenty of the examples explaining how to do this


i.e
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
sngInnerX = X
sngInnerY = Y
End Sub

Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Source.Move X - sngInnerX, Y - sngInnerY
End Sub[p/re]


However my problem is is that the object that I wish to drag and drop is a usercontrol therefore it does not seem to have an mouseMove event ( i think). Is there a way of getting round this or am i just being stupid and missing the point.
Thanx P

Drag And Drop
ok now i want to drag and drop my text box i mean to move it on the form but doesn't work i tryed the mouse over but that was stupid wich properties should i use for that one...

Private Sub Text1_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
With Text1(Index)
.Left = .Left + X
.Height = .Height + Y
End With
End Sub

Drag And Drop??
How can I make a picture that can be dragged and dropped around the form? Thanks for any help.

Drag And Drop
I have 2 labels, 'Space' & 'Backspace'
I want to drag and drop these into a textbox so that they act like the space bar and backspace button respectively.
I got the dragdrop thing sussed but can't figure how to put spaces or backspace.....
Help greatly appreciated
cheers

Drag And Drop
I want to let the user drag and drop controls on a form. How?

Drag And Drop
I have a image on the form.i want that The position of the image can be changed by draging the image. How do i do that ?


a novice

Drag And Drop
I have a picture box where a picture will be loaded in runtime. Also in runtime I want the user to be able to click and drag a picture that is included in the form into the picture box on top of the picture loaded into the picture box. I know how to drag and drop, but it won't drap and drop into the picture box on runtime. If you have any code with comments it would help a lot.

thanks,
-Eim

Drag And Drop
I posted a topic like this before and got some replies but not enough to solve my problem.

First off I'll describe my form:
I have a large form with a picture box in the top half, and another in the bottom half that contains a few images.

What I'd like to do is "drag and drop" the images in the bottom picturebox into the top one during runtime.

I fiddled around with some of the image properties including DragMode and I got the image to "drag" but not "drop" where i wanted it to. It would always return to its original position.

My program is riding on the ability to do this and I'd like some assistance with it. Thanks.

Drag And Drop
I want to drag an image (Image1) on the form (Form1) into a Picture box. I've looked at some of the properties but I cant figure out how to move the image at runtime. Help would be good.

Drag And Drop
i have a large rich text box , about the size of the screen. I have a smaller one thats inside the larger text box. I want to be able to move the smaller one around inside the larger one.

I have never used drag and drop, so can someone point me in the right direction?

thanx
spike

Spike

Drag And Drop
VB 5.0

Hello,

I would like to have a simple way to drag text from a listbox to a textbox (or an another simple trick). With the deletion of the text of the listbox after dropping it in the right textbox.
First, I use:
Private Sub List3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If List3.ListCount > 0 And Button = 1 Then
List3.Drag
End If
End Sub
It is O.K.
The problems begin after with:
Private Sub Text2_DragDrop(Source As Control, X As Single, Y As Single)
If Source Is List2 Then Text2.Text = List2.Text
Else
: MsgBox "erreur", vbOKCancel, "Erreur"
End If
End Sub
Error with block IF
My another way is not better:
Private Sub list6_DragDrop(Source As Control, X As Single, Y As Single)
If Source Is List3 Then
List6.AddItem List3.Text
List3.RemoveItem (0)
Else
MsgBox "Erreur, essayez encore", vbOKOnly, "Séquence incorrecte"
End If
End Sub

Thanks for help
Regards,
Wil

Drag And Drop
hi

could someone please help me, i have a VSflexgrid with lets say
3 merged cells, within these 3 merged cells is some text for instance
John Doe. Is there a way to drag those three cells with the text
to another part of the grid?

Many thanks

Drag And Drop
Im trying to drag and drop a list of mp3 files from a folder and place them into a listbox.. couldnt find the code anywhere. any help is MUCH appreciated.

Drag And Drop
Hi, is there a way so that I can drag and drop media files from a folder into a listbox so I can open them from the listbox?

Any help would be great, thanks.

Drag And Drop
I have a text box, and I want to be able to drag and drop a file onto it, and the text box will display the content of the file.
Is there any way to do this?
TIA

Drag And Drop
Question: How do you reset the image that is being dragged back to it's original spot? I can make it sit anywhere on the form, however I need it to go back to it's original place when placed in the wrong spot. Any help is appreciated! Thank You

Copyright © 2005-08 www.BigResource.com, All rights reserved