作者easylife123 (easylife)
看板Visual_Basic
标题[.NET] 请教一段程式
时间Tue Aug 12 23:55:30 2008
请输入专案类型(网站专案或者应用程式专案):VB
Private Sub AcceptWorkThread()
Thread.CurrentThread.IsBackground = True
While (True)
Application.DoEvents()
Dim ns As NetworkStream = tc.GetStream() 'Get Data
If ns.CanRead Then
Dim receive() As Byte = New Byte(0) {} '宣告一个阵列
ns.Read(receive, 0, receive.Length)
Dim si As SetInfo
si = AddressOf ShowMessage
Dim obj As Object() = New Object(0) {}
If TypeMode = 0 Then
obj(0) = Convert.ToChar(receive(0)).ToString()
Else
Dim strHex As String = receive(0).ToString("X")
strHex = (IIf(strHex.Length = 1, "0", "")) + strHex
obj(0) = strHex + " "
End If
Me.Invoke(si, obj)
End If
End While
End Sub
Private Sub ShowMessage(ByVal Message As String)
Dim strMessage() As String
txtReceive.Text = txtReceive.Text + Message
End Sub
其中txtReceive显示为:
0000000000000001Volt:2.6V LQI:18
0000000000000001Volt:2.6V LQI:00
0000000000000001Volt:2.6V LQI:18
0000000000000001Volt:2.5V LQI:4C
0000000000000001Volt:2.6V LQI:5C
0000000000000001Volt:2.5V LQI:54
0000000000000001Volt:2.6V LQI:54
0000000000000001Volt:2.5V LQI:50
0000000000000001Volt:2.6V LQI:4C
0000000000000001Volt:2.6V LQI:4C
0000000000000001Volt:2.5V LQI:54
0000000000000001Volt:2.6V LQI:58
0000000000000001Volt:2.6V LQI:54
0000000000000001Volt:2.6V LQI:54
0000000000000001Volt:2.5V LQI:54
欲将上面资讯分别以lable1,lable2,lable3显示为:
0000000000000001-----MAC Address
Volt:2.6V -----------battery life
LQI:18---------------LQI
请问如何更改程式?
感激不尽!
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.126.131.44
1F:推 UniFish:用instr和mid这两只函式吧 08/13 10:52