Solved

VB.Net 2005 - FileListBox, DriveListBox, DirectoryListBox Controls Question?

Posted on 2007-04-02
6
2,441 Views
Last Modified: 2012-05-05
I am using the VB6 FileListBox, DriveListBox, and DirectoryListBox controls in my VB.Net 2005 app. I have the filter set on the FileListBox. What I need to do is select all the files in the FileListBox using my app without the users interaction. I then wish to process each selected file in a for loop. I'm just not sure what properties/methods to use for the FileListBox.

Please help!

Thanks,
Blake
0
Comment
Question by:BlakeMcKenna
  • 3
  • 2
6 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 18837015
What are you wanting to do 'with' the files?
You should be able to simply loop through them...

Dim x As Int16
For x = 0 To File1.ListCount - 1
  Console.WriteLine File1.List(x)
Next
0
 

Author Comment

by:BlakeMcKenna
ID: 18837081
I just want to open them and process the data. I just wasn't sure how to select them or if I needed to. However, the ListCount property should work.

Thanks,
0
 

Author Comment

by:BlakeMcKenna
ID: 18837087
Actually, there is no listcount property. At least I didn't see one thru intellisense!
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 18837380
Those controls have been "updated" to be more consistent with .Net syntax so they have an Items() collection now...

Public Class Form1

    Private Sub FormC_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        FileListBox1.Path = "c:\"
        FileListBox1.Pattern = "*.txt"
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        For i As Integer = 0 To FileListBox1.Items.Count - 1
            FileListBox1.SelectedIndex = i
            Application.DoEvents()
            Debug.Print(FileListBox1.Items(i))

            System.Threading.Thread.Sleep(250) ' simulated processing

        Next
        MsgBox("Done!")
    End Sub

End Class
0
 

Author Comment

by:BlakeMcKenna
ID: 18837474
How do I reference the filename?
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 18837483
I showed that in this line:   =)

    Debug.Print(FileListBox1.Items(i))

So use "FileListBox1.Items(i)"...

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now