Coding Thread, A VB.net Program i don't have a Clue how todo! in Coding and Web Development; Hi everyone.
first of all. let me explain my situation.. we have our exchange do an automatic backup to our ...
28th March 2008, 08:53 AM #1
28th March 2008, 09:52 AM #2
I'm very rusty on VB, I'm afraid but I can tell you that you're probably looking for DateTime.Compare. You could do something like this:
If result is 0, there's no difference. If it's less than 0, dt1 is earlier than dt2 and if it's greater than 0, dt1 is later than dt2. If that code doesn't work, someone who's actually written some VB in the last year might be able to do something with it.
Dim file1 As New System.IO.FileInfo("yourfilepath")
Dim result As Integer
result = DateTime.Compare(file1.LastModified, DateTime.Date)
Last edited by bizzel; 28th March 2008 at 10:05 AM.
28th March 2008, 10:19 AM #3
For what your doing it sounds like VB.NET might be over-engineered / overly complex. You might be better off using VBS or something similar.
Ron's Hard Tutorial - VBScript Date and Time Functions
28th March 2008, 10:45 AM #4
2nd June 2008, 01:57 PM #5
- Rep Power
This is the error im currently having, i stripped out all the caparison code, and just got it to output into a MSGBOX but i keep getting this error. and as usual, microsoft help is no help!
screenshot should(first time using uploaded) attatched..
2nd June 2008, 02:36 PM #6
You're running it from a network location? Copy it onto the local hard drive, the framework gets stroppy about security otherwise.
2nd June 2008, 02:56 PM #7
- Rep Power
no. im running the application locally. its checking file infomation on a network file..
2nd June 2008, 09:24 PM #8
Never used it, but this sticks out a bit:
"My Computer" could be a problem considering the file is on some other computer. Get rid of that and try it the System.IO.FileInfo way bizzel mention back in March.
3rd June 2008, 10:23 AM #9
Basically, that error boils down to "nuh uh, I don't have permission to access that item", which could be a lot of things. In this case, it's telling you that it doesn't have permission to read. Assuming that you can access the file with explorer, I'd give System.IO.FileInfo a spin and see if that changes anything.
By strawberry in forum Educational Software
Last Post: 27th January 2010, 01:16 PM
By boomam in forum How do you do....it?
Last Post: 24th January 2008, 08:46 AM
By sqdge in forum General Chat
Last Post: 1st August 2007, 07:11 AM
By contink in forum Windows
Last Post: 5th February 2007, 12:00 PM
By beeswax in forum Other Stuff
Last Post: 14th July 2006, 12:21 PM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)