Vb.net label.text赢得';不显示读线

Vb.net label.text赢得';不显示读线,vb.net,networking,Vb.net,Networking,我必须使用vb 2010来使用网络程序。我试图在标签文本中显示ReadLine流,但它不会显示。请帮忙 Dim tcpCli As TcpClient = tcpList.AcceptTcpClient() 'claiming tcp listener to accept the tcp client Dim ns As NetworkStream = tcpCli.GetStream ' assign ns as network stream and assign as client to

我必须使用vb 2010来使用网络程序。我试图在标签文本中显示ReadLine流,但它不会显示。请帮忙

Dim tcpCli As TcpClient = tcpList.AcceptTcpClient() 'claiming tcp listener to accept the tcp client

Dim ns As NetworkStream = tcpCli.GetStream ' assign ns as network stream and assign as client to get nw stream
Dim sr As New StreamReader(ns)

''''''''' get data from client '''''''''''''''
Dim list As New List(Of String)
Dim receivedData As String = sr.ReadLine()

MsgBox("Operation Performed!!!", MsgBoxStyle.Information, "Accepted by client")
Form1.lblRreadStream.Text = receivedData.ToString() '<< this is the line i'm stuck in with.
Dim tcpCli As TcpClient=tcpList.AcceptTcpClient()'声明tcp侦听器接受tcp客户端
Dim ns As NetworkStream=tcpCli.GetStream'将ns分配为网络流,并将其分配为客户端以获取nw流
Dim sr作为新的StreamReader(ns)
从客户处获取数据
作为新列表的Dim列表(字符串)
Dim receivedData As String=sr.ReadLine()
MsgBox(“已执行操作!!!”,MsgBoxStyle.Information,“已被客户端接受”)

Form1.lblReadStream.Text=receivedData.ToString()“根据您的需求,您可以执行以下操作之一:

    Dim receivedData As String = sr.ReadLine()
    While (sr.ReadLine() <> Nothing)
        receivedData += sr.ReadLine()
    End While

    Form1.lblRreadStream.Text = receivedData

希望对你有所帮助。我非常需要..我把receivedData改为“已执行操作!!!”。它还在展示。字符串为“已连接”。只有标签不会显示字符串。“receivedData”的长度是多少?(从receivedData.Length开始)我从不定义长度。o、 您不必定义它,它是自动设置的。添加第二个MsgBox:MsgBox(“长度:&receivedData.Length”)
   Form1.lblRreadStream.Text = sr.ReadToEnd()