资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

转vb.net的简单介绍

vb的回调函数转为vb.NET

先声明一个委托:

我们提供的服务有:成都做网站、网站建设、微信公众号开发、网站优化、网站认证、鄞州ssl等。为上千企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的鄞州网站制作公司

Public Delegate Function EnumChildProc(hwnd As Integer, iParam As Integer) As Integer

然后才能使用回调函数,回调函数的参数要和委托完全一致。

然后那个 API 函数需要这样声明:

Declare Function EnumChildWindows Lib "user32" (hWndParent As Integer, lpEnumFunc As EnumChildProc, lParam As Integer) As Integer

下面的VB6.0编写的代码怎么转为VB.net

Dim file1 As FileStream

filename = "c:\temp\MyTest.txt"

Dim GetData(4) As Byte, s(4) As Char

file1 = System.IO.File.OpenRead(filename)

Dim CMGs As Long

Dim DPBo As Long

Dim i As Integer = 0, j As Integer

While file1.Read(GetData, 0, 5)  0

i = i + 1

For j = 0 To 4

s(j) = ChrW(GetData(j))

Next

If s = "CMG=""" Then CMGs = i

If s = "[Host" Then DPBo = i - 2 : Exit While

End While

主要是vb.net取消了定长字符串, 所以用字节数组读入, 还得转成字符数组来比较.

C语言转换为VB.NET

Option Explicit On

Option Strict On

Imports System

Module Program

Sub Main()

Dim y,m,t As Integer

begin:

' 输入数据时一行一个

y=CInt(Console.ReadLine())

m=CInt(Console.ReadLine())

t=CInt(Console.ReadLine())

If y

200 Then

Console.WriteLine("ERROR")

goto begin

End If

pr(y,m,t)

Console.Write("Press any key to continue . . . ")

Console.ReadKey(True)

End Sub

Function pr(y As Integer,m As Integer,t As Integer) As Integer

Dim ye,[Me],i As Integer

ye=CInt((m+t-2)/12+y)

[Me]=(m+t-2) Mod 12+1

End If

End Function

Function mday(y As Integer,m As Integer) As Integer

Dim day As Integer()={0,31,28,31,30,31,30,31,31,30,31,30,31}

Dim ad As I


网页标题:转vb.net的简单介绍
地址分享:http://cdkjz.cn/article/dddspsi.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220