vb.net轉換ass,vb60转net

VB.NET中怎么将16进制数换成对应的ASCII,比如说&H1000,怎么把他换成31H,30H,30H,30H

Public Function dec_to_hex(dec As Long) As String

十多年的莱山网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。成都营销网站建设的优势是能够根据用户设备显示端的尺寸不同,自动调整莱山建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。创新互联建站从事“莱山网站设计”,“莱山网站推广”以来,每个客户项目都认真落实执行。

Dim a As String

dec_to_hex = ""

Do While dec 0

a = CStr(dec Mod 16)

Select Case a

Case "0": a = "30H"

Case "1": a = "31H"

Case "2": a = "32H"

Case "3": a = "33H"

Case "4": a = "34H"

Case "5": a = "35H"

Case "6": a = "36H"

Case "7": a = "37H"

Case "8": a = "38H"

Case "9": a = "30H"

Case "10": a = "65H"

Case "11": a = "66H"

Case "12": a = "67H"

Case "13": a = "68H"

Case "14": a = "69H"

Case "15": a = "70H"

End Select

dec_to_hex = a " " dec_to_hex

dec = dec \ 16

Loop

End Function

vb.net字符串 替换

x="a[11dsfsf]b"

b=x.lastindexof("]")

a=x.indexof("[")

x=x.substring(0,a) "0" x.substring(b)

vb.net,强类型转换

这属于装箱拆箱。我举个例子你就明白了:

Dim x As Integer = 5

Dim o As Object = x '装箱

Dim y As Integer = CType(o, Integer) '拆箱(在Option Strict Off的情况下,直接用o给y赋值,会发生自动转换,也就是说在这种情况下,你不必显式调用CType函数)

另外:VB.NET支持后期绑定,所以你也可以不进行拆箱,直接在Object类型下就可以调用它的属性和方法

比如,下面的语句在Option Strict Off是是合法的

Dim s As String = 886

Dim i As Integer = "53"

Dim f As Object = New Form()

f.Show() '注意,f是Object类型的

总之,VB.NET的语法要比C#灵活得多


分享标题:vb.net轉換ass,vb60转net
文章出自:http://myzitong.com/article/phcosc.html