书通范文网 -工作总结,演讲稿,思想汇报,信函等各种范文。
书通网logo
当前位置: 书通网 > 范文 > 心得体会 > 学习vb的心得体会(2)

学习vb的心得体会(2)

时间:2014-12-05 作者:涂画 分类:心得体会 来源:书通网

下面是我测试实际过程

大家也可以和我一样练习练习

下面是我的源代码 可以供大家参考下 也希望高手指点下 (框架就没必要给了) dim baud as string

dim text2enbale, asciflag as boolean '停止显示标志 false将不能显示

private sub check2_click()

end sub

private sub combo1_click()’端口控制

select case combo1.text

case "com1"

mscomm1.commport = 1

case "com2"

mscomm1.commport = 2

case "com3"mscomm1.commport = 3

case "com4"

mscomm1.commport = 4

case "com5"

mscomm1.commport = 5

case "com6"

mscomm1.commport = 6

end select

end sub

private sub combo2_click()’波特率控制

if mscomm1.portopen = true then

mscomm1.portopen = false

select case combo2.text

case "300"

baud = "300"

case "600"

baud = "600"

case "1200"

baud = "1200"

case "2400"

baud = "2400"

case "4800"

baud = "4800"

case "9600"

baud = "9600"

case "19200"

baud = "19200"

case "38400"

baud = "38400"

end select

mscomm1.settings = baud & ",n,8,1"

mscomm1.portopen = true

else

select case combo2.text

case "300"

baud = "300"

case "600"

baud = "600"

case "1200"

baud = "1200"

case "2400"

baud = "2400"

case "4800"

baud = "4800"

case "9600"

baud = "9600"

case "19200"

baud = "19200"

case "38400"

baud = "38400"

end select

mscomm1.settings = baud & ",n,8,1"

end if

end sub

private sub command5_click()

'dim s as string

dim a() as byte

if mscomm1.portopen = false then

msgbox "串口未打开,请打开串口", 48, "警告"

end if

'redim a(3)

'a(0) = &hf

'a(1) = &hfe

'a(2) = &hdd

'a(3) = &hcc

s = text3.text

'a = s

mscomm1.rthreshold = len(s) ' ubound(a) + 1

if mscomm1.portopen = true then

mscomm1.output = s

end if

call delay(20)

end sub

private sub mscomm1_oncomm()

推荐阅读