Hej jensen, denne viser indholdet af en mappe i en liste på en form, måske dette kan indspirere lidt
Public Function GetFiles(stDir As String) As String Dim stName As String Dim tmpList As String
On Error GoTo err_FillFiles
'List all files in this folder stName = Dir(stDir & "\*.*") Do While stName <> "" On Error Resume Next If (GetAttr(stDir & stName) And vbDirectory) <> vbDirectory Then 'File Already open? If Err.Number = 5 Then Err.Clear
If stName <> "." Or stName <> ".." Then 'FileList.Add Item:=(stName) tmpList = tmpList & stName & ";" End If End If 'Get Next entry stName = Dir Loop GetFiles = Left(tmpList, Len(tmpList) - 1) exit_FillFiles: Exit Function err_FillFiles: If Err.Number = 71 Then MsgBox AccessError(Err.Number) _ & " Prøv venligst igen. ", vbCritical + vbOKOnly, _ "Fejl ved læsning af drev " & stDir End If Resume exit_FillFiles End Function
På en kanp eller på form_load lægger du denne kode:
Godt spørgsmål, jeg ved det ikke, har prøvet at kikke, det ser ud som at man skal downloade en excelfil. her er et link der måske kan hjælpe yderligere:
I actually have the FMS Controls, just not here at work! I dont think it is possible to open two dialogs at the same time. Normally when you open a dialog then events to the code where you opend the dilaog from will not continue until the dialog gets closed. But I have NOT tried so I am not 100% sure!
And I dont think that drag and drop can be used either.
I seem to recall that drag and drop CAN be used between treeView and listview controls, and if so using these would be very user friendly.
Ok :o) I want First Treeview to view files in "C:\Data\From\" and the second Treeview to view files in "C:\Data\To\" and Drag´n Drop between those two ...
Is that possible, and what syntax do I use in Form_load ???
:o) I think you should look at the treeview article aandersen has made http://www.eksperten.dk/artikler/647 and instead of loading data from recorsets you need to read the files in he folders.
depends what tricky means! The solution isnt an off-the-shelf component so will need programming which will take a bit of time. So if time = tricky then yes it is a bit tricky and if problems = trick then it might be a bit tricky too :o)
Hvis det er ift. treeview mener jeg at nih har lagt et link i sin artikel med et eks. på hvordan treeview fungere, jeg kender desværre ikke syntaxen til Drag'en drop, men har på fornemmelsen at det måske er nemmere at styre i treeview, da denne kontrol har nogle "indbygget" metoder til Drag,en drop, men der skal stadig skrives kode som jeg ikke kender
Jeg fandt da ud af, hvordan jeg skulle tilgå problemet, nemlig via TreeView komponenten, men min søgning efter yderligere hjælp i bl.a. MSDN gav ikke noget brugbart resultat ... har derfor oprettet et nyt spørgsmål ( med flere point )
Jeg har svaret Jensen363 med følgende kode på en form med 2 listview's og 2 tekstbokse
derudover er der en opset tabel med default værdier for de 2 mappenavne
Private Sub ActiveXKtl5_OLEDragDrop(Data As Object, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single) Dim filFlyttet As String Dim filNy As String
opdaterLst Me.ActiveXKtl4.Object, Me.Tekst0 End Sub
Private Sub Tekst2_BeforeUpdate(Cancel As Integer) opdaterLst Me.ActiveXKtl5.Object, Me.Tekst2 End Sub Sub opdaterLst(list As ListView, mappe As String) Dim stName As String
Dim itmX As ListItem
list.ListItems.Clear
stName = Dir(mappe & "\*.*") Do While stName <> "" On Error Resume Next If (GetAttr(mappe & stName) And vbDirectory) <> vbDirectory Then 'File Already open? If Err.Number = 5 Then Err.Clear
If stName <> "." Or stName <> ".." Then Set itmX = list.ListItems.Add(, , stName)
End If End If 'Get Next entry stName = Dir Loop End Sub
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.