Click here to Skip to main content
15,036,363 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am having some problem during convert below code from VB to VB.NET

VB
Dim LCID As Integer
Dim newFormat As String
LCID = GetSystemDefaultLCID()
newFormat = d1
        
Call SetLocaleInfo(LCID, LOCALE_SSHORTDATE, newFormat)
Call PostMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0)

Call EnumDateFormats(AddressOf EnumCalendarDateProc,LCID,DATE_SHORTDATE)

But it gives error in addressof syntax.

How can I represent AddressOf syntax in
Call EnumDateFormats(AddressOf EnumCalendarDateProc, LCID,DATE_SHORTDATE) when converting VB application to VB.NET
Posted
Updated 11-Feb-10 6:00am
v6

1 solution

You're trying to call Windows API methods that aren't directly accessible from .Net.

You need to import the System.Runtime.InteropServices and learn about Invoke. Go to tis site for windows API prototypes for .Net:

pinvoke.net[^]

They have both VB and C# examples for most functions.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900