<p>I have a VB6 program that someone recently helped me convert to VB.NET</p>

<p>In the program, when saving files, I stamp them with the date which I was getting by calling the Today() function. </p>

<p>When I try to run the new VB.NET code in Vista it throws a permission exception for the Today() . If I run Visual Studio Express (this is the 2008 Express version) in Admin mode, then the problem doesn't occur, but clearly I want to end up with a stand-alone program which runs for all users without fancy permissions.</p>

<p>So how can a normal VB.NET program in Vista get today's date?</p>

Use
```
DateTime.Now
```
or
```
DateTime.Today
```
.  These are entirely managed and shouldn't throw security exceptions.
The old VB6 functions, such as
```
Len()
```
,
```
Left()
```
,
```
Right()
```
,
```
OpenFile()
```
,
```
FreeFile()
```
are all present in the .NET Framework in the Microsoft.VisualBasic DLL.  To maintain backwards compatibility, they all call the old functions in unmanaged code.  Unmanaged code requires special security permissions because it can be dangerous.
Whenever possible, try and use the newer .NET functions.  They are usually much faster (File IO using Streams for instance) and safer.