|
Both the FileInfo and DirectoryInfo classes inherit from FileSystemInfo , which has the properties you need. For example, LastWriteTime is the modified date/time. Just off the top of my head:
Imports System.IO
Imports System.Collections
...
Public Shared Function Search(ByVal folder As String, ByVal minDate As Date) As FileInfo()
Dim files As New ArrayList()
Dim folderEntry As New DirectoryInfo(folder)
SearchInternal(folderEntry, files, minDate)
Return DirectCast(files.ToArray(GetType(FileInfo)), FileInfo())
End Function
Private Shared Sub SearchInternal(ByVal folder As DirectoryInfo, ByVal files As ArrayList, ByVal minDate As Date)
If folder.Exists Then
' List the files in the current directory
Dim file As FileInfo
For Each file In folder.GetFiles()
If file.LastWriteTime > minDate Then
files.Add(file)
End If
Next
' Search the subdirectories
Dim subfolder As DirectoryInfo
For Each subfolder In folder.GetDirectories()
SearchInternal(subfolder, files, minDate)
Next
End If
End Sub
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
What is the equivalent of vbcrlf in vb.net
|
|
|
|
|
try :
\n\r in the string this works in C#
|
|
|
|
|
VBCRLF works in .net too
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
I've never programmed Visual Basic so.... Why do I see all these quotes on the bottom of people's post dissin' on VB?
/\ |_ E X E GG
|
|
|
|
|
ParseException: The two elements in your post "I've never programmed Visual Basic" and "Why do I see all these quotes on the bottom of people's post dissin' on VB?" are not related.
Hope this helps
|
|
|
|
|
i've never programmed it so.... i wouldn't know why it would suck... so???
/\ |_ E X E GG
|
|
|
|
|
At some point you have to debug this exception. You can't just keep ingoring it. Deep down though I realise it's an essential part of the program flow however.
|
|
|
|
|
Posting this question, on this board, is a troll.
I could tell you why I don't like VB, but I won't on this board, because I think that would just be rude. Ask in the soapbox, and I'd be happy to elaborate.
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|
Hi,
I need to write a generic function which,
a) accepts a collection object
b) determines the type of a single object (i.e. collection of what type)
c) instantiate an object of the type found in step b (using reflection maybe)
Here is the function declaration,
Function GetNewSingleObject(ByVal colObjectCollection as Collection) As Object
My question is how do I determine the type of a single object (step b).
Any thoughts?
Appreciate your help.
Thanks.
Vidvan
|
|
|
|
|
Is it to be assumed that every member of the collection is of the same type? The supplied framework collections objects make no such assumption.
If so, check the first member and use the GetType()[^] method derived from the object base class. From there you can use reflection to instanciate a new object.
α.γεεκ Fortune passes everywhere. Duke Leto Atreides
|
|
|
|
|
use the function TypeName
|
|
|
|
|
I am having a problem where I am importing/exporting rows from one database into another and there are approximately 500 rows with data. The user clicks on a button to import and the form sticks up until such time as the processing completes (import/export all rows) which takes like a minute. The processing goes through a couple tables to get data for the processing and takes too long (like 1 - 2 minutes) and all the forms stick up while processing. Any suggestions for improving having some sort of progress bar/ preventing the forms from sticking on this would be greatly appreciated! I am using recordset queries to get data to do all the comparisons etc. for import/export..
|
|
|
|
|
Hi,,
as you are using recordsets to transfer data you can use Doevents function before each call to MoveNext ..
this gives the form the ability to process messages (Events)
using a progress bar is a good idea..
|
|
|
|
|
Thanks!! That has definitely helped!!
|
|
|
|
|
I've been looking for how to get my hands on the command line arguments (argv, argc, in C/C++) in a VB app. I've searched MSDN and all my VB books and just can't find anything. I'm sure it's something very simple , but I'm not having any luck on my own. Help please?
Thanks, Dave
QRZ? de WAØTTN
|
|
|
|
|
Hi
use Command() Function
it returns the command line arguments as a variant containing array of args.
|
|
|
|
|
Thank you! Just what I was hoping for.
QRZ? de WAØTTN
|
|
|
|
|
two things:
1) im making an app in which there is a form which is also a mdicontainer ....now...i need another control box kind of thing inside this form.this control box is basically an outcome of the data wizard..so its connected to oracle. also in the control box there is a button which when clicked opens up several other forms...now the prob is all these forms that get opened after clicking the button should be children of the main MDI form. how should i do that? in the button code..what i did was
dim newform as new form2() ....[this is one of the many forms to be opened up after button down]
newform.mdiparent = form1() ....[form1 is the main form]
newform.show()
now the error is that form is supposedly of type ??!?? so the code doesnt compile
2) how do i build this application and make it run on a system which doesnt have .NET installed?
|
|
|
|
|
What!?
#1.) There should not be a problem as long as your MDI Form's "MDIContainer" Property = True.
#2.) You can't
|
|
|
|
|
I create a class using the System.Timers and the FileWatcher. The on the main form I have a global variable to that class. Called m_FileMon. In a command button I instance a new copy of that class. Every time I click the command button I get a new instance even though I only have one variable for that class. Does anyone have any idead why this is happening. Is this because the system timers or the Filesystemwatch are multithreaded?
Any help would be greatly appriciated.
Forever Developing
|
|
|
|
|
Because you asked for one?
What is it that you are trying to accomplish?
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Unknown wrote:
"I love long walks, especialy taken by those that annoy me."
Paraphrased from TMNT:
"Cricket? You have to know what a crumpet is to understand Cricket."
|
|
|
|
|
Here hope this helps clarify things a bit more.
(Psudo code to follow)
Public Class frmMain
'This the standard windows form code
Private m_FileMon as clsMyFileMon
Private sub_cmdStart_Click
m_FileMon = new clsMyFileMon
End Sub
End Class
Public Class clsMyFileMon
Imports System.IO
Imports System.Timers
Imports System.Diagnostics
Public Sub New
'Starting new timers and a new instance of
'the filesystem watcher. Using AddHandler
'to add event handlers for the timer_tick event and
'the filesystemwatcher created event.
End sub
End Class
'I am watching for the creation of files in a specific folder
'then after a given amount of time I delete those files
End Class
So here is the problem. Every time I click cmdStart it is
starting another instance of my class. I know this because for every click of cmdStart I am getting another set of timers. The old instance is not being cleaned up. I have tried to kill the old instance by m_FileMon = Nothing, but the Finalize event does not fire.
Is this because the timers and the filesystemwatch are executing on different threads?
Do I need to implement IDispose to unhook the timers from my object and force the
garbage collector to kill my class?
Any help would be greatly appriciated.
Forever Developing
|
|
|
|
|
ElseIf txtVAT.Text <> " & IE#######% & " Then
MsgBox "Please enter a valid VAT Number starting with IE ", vbExclamation, "Invalid Data"
Exit Sub
the above is the code i use to ensure a VAT number is entered in correctly (ie an example of a correct VAT number is IE5314569A), however, it throws the message box regardless. What would be the correct syntax? Any help would be greatly appreciated!
|
|
|
|
|
Hi..
Why don't use MaskEdit control ?
anyway .. to compare strings use strComp function.
|
|
|
|