Filelist box Multiselect strange ?
Filelist box Multiselect strange ?
Filelist box Multiselect strange ?
Filelist box Multiselect strange ?
Filelist box Multiselect strange ?
Filelist box Multiselect strange ? Filelist box Multiselect strange ? Filelist box Multiselect strange ? Filelist box Multiselect strange ? Filelist box Multiselect strange ? Filelist box Multiselect strange ? Filelist box Multiselect strange ? Filelist box Multiselect strange ?
Filelist box Multiselect strange ? Filelist box Multiselect strange ?
Filelist box Multiselect strange ?
Go Back  Xtreme Visual Basic Talk > > > Filelist box Multiselect strange ?


Reply
 
Thread Tools Display Modes
  #1  
Old 09-13-2016, 01:05 PM
Circe Circe is offline
Regular
 
Join Date: Feb 2013
Posts: 72
Unhappy Filelist box Multiselect strange ?


Well, with this code I can delete the files selected in my filelist box using multiselection nº 1 in filelist box properties.

Code:
Private Sub Command_Click()
Dim k As Long
Dim s As String

For k = 0 To File1.ListCount - 1
    If File1.Selected(k) Then
        s = File1.List(k)
        Kill (s)
        
    End If

Next
File1.Refresh

End Sub

But I created a tiny program to play file sounds that uses Filelistbox, too..
But..... here´s the problem, because I use the same code, but when i try to delete them It appears ... File dont exists...code 53,
I have used delete to recyclebyn instead kill to recover,
I think is the problem of the paths..sure. But I cant solve
Help please !!!!
Attached Files
File Type: zip Multiplayer.zip (6.6 KB, 4 views)
Reply With Quote
  #2  
Old 09-13-2016, 08:06 PM
Kluz's Avatar
KluzFilelist box Multiselect strange ? Kluz is offline
Sapience.Aquire

Super Moderator
* Expert *
 
Join Date: Oct 2003
Location: Lake Bluff, Ill., U.S.
Posts: 3,420
Default

Have you tried looping backwards through the list? It doesn't make sense, but it is Microsoft.
__________________
No the other right mouse click
Reply With Quote
  #3  
Old 09-14-2016, 12:55 PM
Circe Circe is offline
Regular
 
Join Date: Feb 2013
Posts: 72
Default

May be im a nut, I Have put a loop, but makes the same ! Any line Code well written ? Thanks.


Just I put:

Do
Kill (S)
Loop until filefiles .listindex = filefiles.listcount - 1


Buahhhhh !!!!

Last edited by Circe; 09-14-2016 at 01:53 PM.
Reply With Quote
  #4  
Old 09-14-2016, 02:45 PM
Cerian Knight's Avatar
Cerian KnightFilelist box Multiselect strange ? Cerian Knight is offline
Multi-Technologist

Super Moderator
* Expert *
 
Join Date: May 2004
Location: Michigan
Posts: 4,143
Default

Per Kluz's recommendation, instead of:
For k = 0 To File1.ListCount - 1
Try:
For k = File1.ListCount - 1 to 0 Step -1
__________________
I got all the answers wrong on the GLAT, apparently even #9 (where I put a period in the middle of the box and labeled it 'singularity ripe for rapid inflation').
Reply With Quote
  #5  
Old 09-15-2016, 03:48 AM
Circe Circe is offline
Regular
 
Join Date: Feb 2013
Posts: 72
Default

Thanks Cerian for your answer. But still appear the message.....error 53.....file not found.


A trick... When I launch the application only can delete the files that appear in it, but when I change the Drive or directory..trying to delete any file....Error 53

Any sugestión ?. Such a strange before your change, as the above Code Up, is possible to delete then, but when I change a directory appear the error.

Last edited by Circe; 09-15-2016 at 03:56 AM.
Reply With Quote
  #6  
Old 09-15-2016, 11:48 AM
Cerian Knight's Avatar
Cerian KnightFilelist box Multiselect strange ? Cerian Knight is offline
Multi-Technologist

Super Moderator
* Expert *
 
Join Date: May 2004
Location: Michigan
Posts: 4,143
Default

I see the issue... 'Kill' only can access the files in the current directory (CurDir) unless the path is specified. If you want to Kill files in the File1 displayed directory, you have to specify that path, e.g.:
Code:
Kill File1.Path & "\" & s 'This will not work in the root folder of the drive unless the "\" is removed (and you have access rights)
__________________
I got all the answers wrong on the GLAT, apparently even #9 (where I put a period in the middle of the box and labeled it 'singularity ripe for rapid inflation').
Reply With Quote
  #7  
Old 09-16-2016, 06:35 AM
Circe Circe is offline
Regular
 
Join Date: Feb 2013
Posts: 72
Default

Thanks again. now it detele all the selected items in the filelistbox. BUT the last item deleted still appear in the list ! ( i know its deleted ,I check the folder) but still is viewed, I have put a file.refresh, but still appears....such a nuty... How to clear in the filelistbox window the last item deleted?

Thks.!
Reply With Quote
  #8  
Old 09-16-2016, 11:27 AM
Cerian Knight's Avatar
Cerian KnightFilelist box Multiselect strange ? Cerian Knight is offline
Multi-Technologist

Super Moderator
* Expert *
 
Join Date: May 2004
Location: Michigan
Posts: 4,143
Default

I'm not seeing that behavior here, so I hesitate to offer a work-around without fully understanding the cause.

Do this: Create a new project with a Command button and a FileListBox controls. Create a folder called 'Test' in the root of the 'C:' drive and copy some temporary files into it. Then run this code:
Code:
Private Sub Form_Load()
'File1.MultiSelect = vbExtended 'Must set manually
File1.Path = "C:\Test"
End Sub

Private Sub Command1_Click()
Dim k As Long
Dim s As String
For k = 0 To File1.ListCount - 1
    If File1.Selected(k) Then
        s = File1.List(k)
        Kill File1.Path & "\" & s
    End If
Next
File1.Refresh
End Sub
When I select all files and click the button, they all disappear from the FileListBox. How does this new project behave?

If the new test project does not work properly... confirm that you are running VB6 SP6, as Service Pack 6 is required to resolve many operational anomalies (like you describe).
__________________
I got all the answers wrong on the GLAT, apparently even #9 (where I put a period in the middle of the box and labeled it 'singularity ripe for rapid inflation').

Last edited by Cerian Knight; 09-16-2016 at 11:33 AM.
Reply With Quote
  #9  
Old 09-16-2016, 11:53 AM
Circe Circe is offline
Regular
 
Join Date: Feb 2013
Posts: 72
Smile Solved

Thanks a lot Cerian !!! At last i got it , you help me a lot. The error was in another private function that called for the dir to work the files.So here´s I post the wholw program to anybody wants to use it.


Code:
Private Sub Command1_Click()
Music.FileName = ""
 
Dim i As Long
Dim s As String

For i = fileFiles.ListCount - 1 To 0 Step -1

If fileFiles.Selected(i) = True Then
       
        s = fileFiles.List(i)
        
        Kill fileFiles.Path & "\" & s
                
   End If
 
Next i
fileFiles.Refresh

End Sub

What was music.filename....= was the sub to call and play the files, then I put ""....and Voila...
Reply With Quote
  #10  
Old 09-16-2016, 12:05 PM
Circe Circe is offline
Regular
 
Join Date: Feb 2013
Posts: 72
Default

MMMMM... I cant Upload the file.....So here´s an external link



My_Player_Final

Last edited by Circe; 09-16-2016 at 12:27 PM.
Reply With Quote
Reply

Tags
delete, code, filelist, box, dim, file, kill, appears, filelistbox, here´s, multiselect, exists, paths, solve, recyclebyn, strange, selected, files, file1.listcount, string, private, command_click, multiselection, file1.selectedk, created


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Filelist box Multiselect strange ?
Filelist box Multiselect strange ?
Filelist box Multiselect strange ? Filelist box Multiselect strange ?
Filelist box Multiselect strange ?
Filelist box Multiselect strange ?
Filelist box Multiselect strange ? Filelist box Multiselect strange ? Filelist box Multiselect strange ? Filelist box Multiselect strange ? Filelist box Multiselect strange ? Filelist box Multiselect strange ? Filelist box Multiselect strange ?
Filelist box Multiselect strange ?
Filelist box Multiselect strange ?
 
Filelist box Multiselect strange ?
Filelist box Multiselect strange ?
 
-->