Monday, December 21, 2015

Error accessing the system registry

If you get above error, make sure you open your Visual Studio 6.0 with "Run as Administrator" option.

You can also set this option permanently by going to the file location of Visual Basic 6.0 shortcut.
On the file, right click and go to Properties.
In Properties, select Compatibility tab.
In this tab, you will see "Run this program as an administrator" check box.
Check it and click OK.

This should do the trick permanently and now you don't need to open project by Run as Administrator option anymore.

HTH.

Tuesday, December 15, 2015

Parse Date in VB6

VB6 is not smart to understand some usual date formats that we use daily.
So for example, if you were to put yyymmdd in date type, VB6 will give Type mismatch error.


You would need to parse it to store in date type field as below:


Dim strDate as string
Dim dBusinessDate as date


strDate = "20151211"
dBusinessDate = Mid(strDate, 5, 2) & "/" & Right(strDate, 2) & "/" & Left(strDate, 4)

For more info: See Dates on MS page




HTH