社区
VB
帖子详情
VB.NET 串口接收到字节数组怎样显示到 txtdisplay.Text 上
吭哧康吃
2019-07-19 11:09:18
各位前辈好!
我现在用串口接收到一组字节数据,想把这组字节赋值给文本控件的Text属性。
txtDisplay.Text=SerialPort.ReadExisting
但是这样VB会把字节数据自动转成string格式(收到53,text显示 5)。
请教各位前辈,怎么才能让text直接显示 53 呢?麻烦各位了
...全文
242
4
打赏
收藏
VB.NET 串口接收到字节数组怎样显示到 txtdisplay.Text 上
各位前辈好! 我现在用串口接收到一组字节数据,想把这组字节赋值给文本控件的Text属性。 txtDisplay.Text=SerialPort.ReadExisting 但是这样VB会把字节数据自动转成string格式(收到53,text显示 5)。 请教各位前辈,怎么才能让text直接显示 53 呢?麻烦各位了
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
吭哧康吃
2019-07-19
打赏
举报
回复
这个好像不管用啊,,还是输出5
ManBOyyy
2019-07-19
打赏
举报
回复
DIM str as string
str &=SerialPort.ReadExisting
txtDisplay.Text=str
吭哧康吃
2019-07-19
打赏
举报
回复
引用 3 楼 ManBOyyy 的回复:
[quote=引用 2 楼 王庆宝 的回复:] 这个好像不管用啊,,还是输出5
完整的代碼截圖出來[/quote] 谢谢您,我用这个解决了,谢谢 Dim buf(11) As Byte If SerialPort.BytesToRead > 0 Then Threading.Thread.Sleep(100) '添加的延时 SerialPort.Read(buf, 0, 12) txtDisplay.Text = buf(0) & buf(1) & buf(2) & buf(3) & buf(4) & buf(5) & buf(6) & buf(7) & buf(8) & buf(9) & buf(10) & buf(11)
ManBOyyy
2019-07-19
打赏
举报
回复
引用 2 楼 王庆宝 的回复:
这个好像不管用啊,,还是输出5
完整的代碼截圖出來
微软开源的命令行外壳和脚本环境 PowerShell.zip
clearClear screenmkdirNew-Item -ItemType DirectoryCreate a new foldertouch test.
txt
New-Item -Path test.
txt
Create a new empty filecat test1.
txt
test2.
txt
Get-Content test1.
txt
, test2.
txt
Display
files ...
简易计算器
本软件是我在Csharp 课程设计中设计实现的,以简单的加减乘除为主,以取对数运算\转换二进制\八进制\十六进制为辅,实现了计算机的简单基本功能!
2019-12-27
publie Forml ( ) InitializeComponent (); private void btnNumber. Click (object sender, EvenArgse) //数字类按钮的单击事件 btn = (Button) sender;...
Text
=
txt
Display
.
Text
+ btn.
Text
; priva...
VB中如何将两个单
字节
合成一个双
字节
,例如我输入两个byte类型变量
Private Sub Form_Load() Dim DisNumber as Integer Dim a As Byte Dim b As Byte a=&H80 b=&H0 DisNumber = (a * 256 + b) '将两个单
字节
合成一个双
字节
,就像C语言里把...
Txt
Display
.
Text
= Format(DisNumber, "##0")
实例072简单工厂之简单计算器
Handles Button2.Click If
txt
Display
.
Text
= "0" Then
txt
Display
.
Text
= Mid(
txt
Display
.
Text
+ "2", 2) Else
txt
Display
.
Text
=
txt
Display
.
Text
& "2" End If End Sub Private Sub Button3_Click(ByVal sender ...
VB
16,554
社区成员
110,527
社区内容
发帖
与我相关
我的任务
VB
VB技术相关讨论,主要为经典vb,即VB6.0
复制链接
扫一扫
分享
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章