| 发表于:2007-04-13 13:01:253楼 得分:0 |
参考下列代码: private sub cmdsent_click() dim strsent as string strsent = trim(txtsent.text) if (strsent = " ") then msgbox "发送数据不能为空! ", vbokonly, "提示 " txtsent.setfocus else comsent.output = strsent 'msgbox "已经执行发送! ", vbokonly, "提示 " end if end sub private sub comreceive_oncomm() select case comreceive.commevent case comevreceive comreceive.inputmode = cominputmodetext 'ascii接收 txtreceive.text = comreceive.input msgbox "收到! " end select end sub private sub form_load() txtreceive = " " comsent.commport = 1 comsent.portopen = true comreceive.commport = 2 comreceive.portopen = true comreceive.rthreshold = 1 '其余属性均按默认设置 end sub | | |
|