我只是将我的工作应用程序从 4.6.1 移至框架 4.0,我遇到了唯一的一个问题。我收到的错误消息如主题所示。我还有第二个错误:
SendPingAsync is not a member of 'Ping'
主题错误出现在该行突出显示的以下方法中:
Await IsDestinationReachable(IPAddress)
Method:
Public Async Sub Pinguj(sender As Object, e As EventArgs)
Dim isReachable As Boolean = Await IsDestinationReachable(IPAddress)
ListBox2.Items.Add("a teraz zmiana")
If isReachable Then
tsPingResultIcon.BackColor = Color.Green
Else
tsPingResultIcon.BackColor = Color.Red
End If
End Sub
第二个错误出现在这一行的以下方法中:
pinger.SendPingAsync(hostnameOrAddress)
method:
Public Async Function IsDestinationReachable(ByVal hostnameOrAddress As String) As Task(Of Boolean)
Dim reachable As Boolean = False
Try
If My.Computer.Network.IsAvailable Then
Dim pinger As Ping = New Ping()
Dim result As PingReply = Await pinger.SendPingAsync(hostnameOrAddress)
reachable = result.Status = IPStatus.Success
End If
Catch pingException As System.Net.NetworkInformation.PingException
Catch genericNetworkException As System.Net.NetworkInformation.NetworkInformationException
' Fail silently and return false
End Try
Return reachable
End Function
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)