Click here to Skip to main content
15,923,006 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: How do I delete all files in a folder? Pin
Christian Graus18-Nov-06 12:55
protectorChristian Graus18-Nov-06 12:55 
AnswerRe: How do I delete all files in a folder? Pin
Janani Divya17-Nov-06 15:22
Janani Divya17-Nov-06 15:22 
AnswerRe: How do I delete all files in a folder? Pin
The ANZAC18-Nov-06 13:24
The ANZAC18-Nov-06 13:24 
GeneralRe: How do I delete all files in a folder? Pin
Code Crapper19-Nov-06 2:14
Code Crapper19-Nov-06 2:14 
QuestionHow to open and view TIF in Access Pin
Tech.Wizard17-Nov-06 13:19
Tech.Wizard17-Nov-06 13:19 
QuestionProblem: .NET 2.0 File.GetLastWriteTime(path) Keeps adding 1 hour Pin
zonkerman17-Nov-06 13:12
zonkerman17-Nov-06 13:12 
AnswerRe: Problem: .NET 2.0 File.GetLastWriteTime(path) Keeps adding 1 hour Pin
Johan Hakkesteegt19-Nov-06 22:20
Johan Hakkesteegt19-Nov-06 22:20 
AnswerRe: Problem: .NET 2.0 File.GetLastWriteTime(path) Keeps adding 1 hour Pin
Cheeso8-Mar-09 12:35
Cheeso8-Mar-09 12:35 
No, the problem occurs because Win32 and .NET make different choices with regard to dealing with Daylight Saving Time.

For a discussion, see here:
http://blogs.msdn.com/oldnewthing/archive/2003/10/24/55413.aspx

To compensate, you have to adjust the time you use with SetLastWriteTime and GetLastWriteTime. When setting, adjust from .Net to Win32. When getting, adjust from Win32 to .NET. Here's some example code:

// If I have a time in the .NET environment, and I want to use it for
// SetWastWriteTime() etc, then I need to adjust it for Win32.
static DateTime AdjustTime_DotNetToWin32(DateTime time)
{
  DateTime adjusted = time;
  if (DateTime.Now.IsDaylightSavingTime() && !time.IsDaylightSavingTime()) 
    adjusted = time - new System.TimeSpan(1, 0, 0); 
  else if (!DateTime.Now.IsDaylightSavingTime() && time.IsDaylightSavingTime()) 
    adjusted = time + new System.TimeSpan(1, 0, 0); 

  return adjusted;
} 


// If I read a time from a file with GetLastWriteTime() (etc), I need
// to adjust it for display in the .NET environment.  
static DateTime AdjustTime_Win32ToDotNet(DateTime time)
{
    DateTime adjusted = time;
    if (DateTime.Now.IsDaylightSavingTime() && !time.IsDaylightSavingTime())
	adjusted = time + new System.TimeSpan(1, 0, 0);

    else if (!DateTime.Now.IsDaylightSavingTime() && time.IsDaylightSavingTime())
	adjusted = time - new System.TimeSpan(1, 0, 0);

    return adjusted;
}


void MySetLastWriteTime(String targetFile, DateTime t)
{ 
  DateTime adjusted = AdjustTime_DotNetToWin32(t);
  System.IO.File.SetLastWriteTime(targetFile, adjusted);
}


DateTime MyGetLastWriteTime(String targetFile)
{ 
  DateTime t = System.IO.File.GetLastWriteTime(targetFile);
  return AdjustTime_Win32ToDotNet(t);
}

QuestionHow Check if the User Control is already viewed ?? Pin
kindman_nb17-Nov-06 13:03
kindman_nb17-Nov-06 13:03 
AnswerRe: How Check if the User Control is already viewed ?? Pin
Christian Graus17-Nov-06 13:10
protectorChristian Graus17-Nov-06 13:10 
GeneralRe: How Check if the User Control is already viewed ?? Pin
kindman_nb17-Nov-06 13:21
kindman_nb17-Nov-06 13:21 
GeneralRe: How Check if the User Control is already viewed ?? Pin
Christian Graus17-Nov-06 15:07
protectorChristian Graus17-Nov-06 15:07 
QuestionRemoving all checked items in a checked list box. Pin
The ANZAC17-Nov-06 11:05
The ANZAC17-Nov-06 11:05 
AnswerRe: Removing all checked items in a checked list box. Pin
Are Jay17-Nov-06 18:13
Are Jay17-Nov-06 18:13 
AnswerRe: Removing all checked items in a checked list box. Pin
Daytona_67518-Nov-06 3:38
Daytona_67518-Nov-06 3:38 
GeneralRe: Removing all checked items in a checked list box. Pin
The ANZAC18-Nov-06 10:49
The ANZAC18-Nov-06 10:49 
QuestionDrawing Line and Bar Graph on the same Graph Space Pin
PeterTF17-Nov-06 9:12
PeterTF17-Nov-06 9:12 
AnswerRe: Drawing Line and Bar Graph on the same Graph Space Pin
Christian Graus17-Nov-06 13:11
protectorChristian Graus17-Nov-06 13:11 
QuestionGoogle Translate in vb.net Pin
JoshKrak17-Nov-06 8:58
JoshKrak17-Nov-06 8:58 
QuestionMultiLanguage Support Pin
Syed Shahid Hussain17-Nov-06 8:49
Syed Shahid Hussain17-Nov-06 8:49 
AnswerRe: MultiLanguage Support Pin
Janani Divya17-Nov-06 15:58
Janani Divya17-Nov-06 15:58 
GeneralRe: MultiLanguage Support Pin
Syed Shahid Hussain18-Nov-06 7:03
Syed Shahid Hussain18-Nov-06 7:03 
QuestionOpen a new Browser Window Pin
Kevin Nicol17-Nov-06 7:23
Kevin Nicol17-Nov-06 7:23 
AnswerRe: Open a new Browser Window Pin
Guffa17-Nov-06 8:10
Guffa17-Nov-06 8:10 
GeneralRe: Open a new Browser Window Pin
Kevin Nicol17-Nov-06 8:42
Kevin Nicol17-Nov-06 8:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.