From: Jon Lewis on 14 Dec 2009 04:43 VB6 controls are native to VB6. The ListView control is part of the Windows Common Controls so that's why you can use it in Access. As Douglas says, a ListView control can't be bound to data but it's pretty easy to populate and refresh with a list of files say in a directory or from a recordset. (My example just loads one sample 'item' to the list view - you would loop through a recordset adding all the relevent items.) Additionally, you can choose the view for the ListView (like a Windows folder). You can display an icon for each item in the list (use the ImageList Common Control to store them) which may be able to take the place of the image control and more than one column for each item. Unless I've misunderstood your requirements, you would look to replace your subform with the ListView, a ListView item replacing each record of the subform . Quite a lot of coding required but very doable. HTH "roger" <roger(a)discussions.microsoft.com> wrote in message news:6959FEF2-C41F-4B7D-8D31-B5BC28DC9962(a)microsoft.com... > This WORKS! > Thanks. > > Only thing is I'm not using a .Listview control. The article said that > other > VB6 controls; picturebox, image, and textbox, all support OLE drag and > drop. > But I don't have any of them in Access. > > Am I missing something? Can I add those controls? > > roger > > "Jon Lewis" wrote: > >> Thought I'd have a bash at this myself, will this work for you? >> (ListView0 is the ListView control from Windows Common Controls 6) >> >> Option Compare Database >> Option Explicit >> Const vbCFFIles = 15 >> Const vbCFText = 1 >> >> Dim lCurX, lCurY As Single >> >> Private Sub Form_Load() >> Dim lstitem As ListItem >> Set lstitem = ListView0.Object.ListItems.Add() >> lstitem.Text = "Sample.txt" >> lstitem.Key = "Fullpath\Sample.txt" >> End Sub >> >> Private Sub ListView0_MouseDown(ByVal Button As Integer, ByVal Shift As >> Integer, ByVal x As Long, ByVal y As Long) >> lCurX = x >> lCurY = y >> End Sub >> >> Private Sub ListView0_MouseMove(ByVal Button As Integer, ByVal Shift As >> Integer, ByVal x As Long, ByVal y As Long) >> If Button = 1 Then >> ListView0.OLEDrag >> End If >> End Sub >> >> >> Private Sub ListView0_OLEStartDrag(Data As Object, AllowedEffects As >> Long) >> On Error GoTo ListView0_OLEStartDrag_Err >> Dim oDrag As ListItem >> Set oDrag = ListView0.HitTest(lCurX, lCurY) >> >> If oDrag Is Nothing Then >> AllowedEffects = ccOLEDropEffectNone >> Else >> AllowedEffects = ccOLEDropEffectCopy >> Call Data.SetData(oDrag.Text, vbCFText) >> Call Data.SetData(, vbCFFIles) >> Call Data.Files.Add(oDrag.Key) >> End If >> Exit Sub >> ListView0_OLEStartDrag_Exit: >> Exit Sub >> ListView0_OLEStartDrag_Err: >> MsgBox Err.Number & ": " & Err.Description >> Resume ListView0_OLEStartDrag_Exit >> End Sub >> >> HTH >> >> "roger" <roger(a)discussions.microsoft.com> wrote in message >> news:B5A2A13B-5B9A-4BA1-AC46-104321885436(a)microsoft.com... >> > Hi Stuart, At least you're involved in "possiblity thinking." >> > >> > I've simulated drag and drop in Access before, but that isn't my goal. >> > The >> > goal here is to actually use Windows drag and drop, and not have to >> > write >> > custom procedures for every app the user could drop on. (just let >> > windows >> > do >> > it) >> > >> > If it helps I'm using MSA 2007 which totally supports drag and drop, >> > you >> > can >> > drag tables and queries out to excel or word, and drop excel ranges in >> > as >> > tables, so it IS in there. >> > >> > If there is really NO way to do it in a form, then I am thinking that a >> > custom control is the answer. (I can't write one, but I would pay to >> > have >> > it >> > written) just a transparent button with three events, click, double >> > click >> > and >> > drag, and programmable value. With no other to drag data out of an >> > Access >> > app, maybe I could sell the control. >> > >> > Damn this is fustrating, from what I read, in .Net, this is as simple >> > as >> > setting .DragBehavoir = enabled. >> > >> >> >> . >>
From: LogicNP on 7 Jan 2010 05:20 Check out FileView ( http://www.ssware.com/fileview/fileview.htm ) - it shows files/folders just like you want with additonal feature of full drag-drop support - this means users can drag files from the control and drop them to other apps like you want.
First
|
Prev
|
Pages: 1 2 3 Prev: RQuestion on Form Record Selector Bar Next: DoCmd.RunSQL combobox column |