最后一个大的馅饼咯,o(∩_∩)o...哈哈

qshurufa 2009-06-23 04:20:07
Private Sub btnWrite_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnWrite.Click
Dim wData As Byte
Dim nPort As Integer = Integer.Parse(cbPort.Text)
If txtWrite.Text <> "" Then
If 2 = txtWrite.Text.Length Then
Dim first_Ch As Char = Convert.ToChar(txtWrite.Text.Substring(0, 1))
Dim second_Ch As Char = Convert.ToChar(txtWrite.Text.Substring(1, 1))
Dim first_Num As Integer = Ascii2Hex(first_Ch)
Dim second_Num As Integer = Ascii2Hex(second_Ch)
If first_Num >= 0 AndAlso second_Num >= 0 Then
wData = Byte.Parse(Convert.ToString(first_Num * 16 + second_Num))
wData = wData And data_Mark
WritePort(nPort, wData)
Else
MsgBox("Please input 00~FF.")
txtWrite.Text = "0"
End If
End If
If 1 = txtWrite.Text.Length Then
Dim last_num As Integer = Ascii2Hex(Convert.ToChar(txtWrite.Text.Substring(0, 1)))
If last_num >= 0 Then
wData = Byte.Parse(Convert.ToString(last_num))
wData = wData And data_Mark
WritePort(nPort, wData)
Else
MsgBox("Please input 00~FF.")
txtWrite.Text = "0"
End If
End If
Else
txtWrite.Text = "0"
MsgBox("Please input 00~FF.")
End If
End Sub
转成VC++.net奉上60分。
...全文
28 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
V68V6 2009-06-24
  • 打赏
  • 举报
回复
up

jf
xupeihuagudulei 2009-06-24
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 cg2003 的回复:]
UP
[/Quote]
cg2003 2009-06-24
  • 打赏
  • 举报
回复
UP

7,540

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 VC.NET
社区管理员
  • VC.NET社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧