将VB代码转换为VB.NET [英] Convert VB code to VB.NET
本文介绍了将VB代码转换为VB.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在将下面的代码从VB转换为VB.NET时,我遇到了一些问题
I am having some problem during convert below code from VB to VB.NET
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)
但这会导致addressof
语法出错.
如何在
中表示AddressOf
语法
Call EnumDateFormats(AddressOf EnumCalendarDateProc, LCID,DATE_SHORTDATE)
在将VB应用程序转换为VB.NET时
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
推荐答案
您正在尝试调用Windows API方法,这些方法无法从.Net直接访问. br/>
您需要导入System.Runtime.InteropServices
并了解Invoke
.前往tis网站获取.Net的Windows API原型:
pinvoke.net [
You''re trying to call Windows API methods that aren''t directly accessible from .Net.
You need to import theSystem.Runtime.InteropServices
and learn aboutInvoke
. Go to tis site for windows API prototypes for .Net:
pinvoke.net[^]
They have both VB and C# examples for most functions.
这篇关于将VB代码转换为VB.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文