[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 178
  • Last Modified:

FILE INFO.

How can I add only files that already exits and file that just created in Listbox? I have set Timer on this sub.

Dim XDir As DirectoryInfo = New DirectoryInfo(Trim("" & Me.txtPathX.Text & ""))

Dim ExtraCount As Integer

Dim myfileInfo as fileinfo

For Each myfileInfo In XDir.GetFiles

ExtraCount = XDir.GetFiles.Length

Me.lblCountExtra.Text = ExtraCount.ToString

Me.ListBox2.Items.Add(myfileInfo.CreationTime)  -------------------- This line just keepS adding the same file(Time it is created) over and over



Next

If ExtraCount = Nothing Then

Me.lblCountExtra.Text = CStr(0)

End If
0
VBdotnet2005
Asked:
VBdotnet2005
  • 2
  • 2
  • 2
1 Solution
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Can you explain in plain english what the code is ~supposed~ to accomplish?   =)
0
 
armoghanCommented:
What I have understood is that you need a directory watcher

http://www.codeproject.com/dotnet/folderwatcher.asp
0
 
armoghanCommented:
or
look for FileSystemWatcher class in MSDN
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
VBdotnet2005Author Commented:
Idle_Mind ,

I want to add a file name and time in a folder to a list box when a new file is added and keep track of how many item in a list box. FileSystemWatcher class?
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Yes...I think armoghan was right on with the FileSystemWatcher.
0
 
VBdotnet2005Author Commented:
thank you
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now