asp.net -SerialPort.DataReceived不添加到列表框项目

时间:2015-12-23 16:01:00

标签: asp.net vb.net serial-port

我想将收到的串口数据添加到列表框

HTML

<%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <meta charset="UTF-8">
    </head>
    <body>
        <div>
              <asp:ListBox ID="listbox1" runat="server" ></asp:ListBox>
        </div>
    </body>
</html>

背后的代码

 Protected Sub SerialPort1_DataReceived(sender As Object, e As SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
        data = SerialPort1.ReadExisting()
        listbox1.items.add(data) 'this not work
        msgbox(data) 'this work
 End Sub

请帮帮我

0 个答案:

没有答案