Maybe this will help but you will have to download the project from codeproject ( link 2 above) to get the network library...
MP
Private adapters As NetworkAdapter() Private monitor As NetworkMonitor
Sub GetNetworkMonitor() monitor = New NetworkMonitor Me.adapters = monitor.Adapters
If adapters.Length = 0 Then Me.ListAdapters.Enabled = False MessageBox.Show("No network adapters found on this computer.") Return End If
Me.ListAdapters.Items.AddRange(Me.adapters) End Sub
Private Sub NetMonitor_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load GetNetworkMonitor() End Sub
Private Sub ListAdapters_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListAdapters.SelectedIndexChanged monitor.StopMonitoring() monitor.StartMonitoring(adapters(Me.ListAdapters.SelectedIndex)) Me.TimerCounter.Start() End Sub
Private Sub TimerCounter_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TimerCounter.Tick Dim adapter As NetworkAdapter = Me.adapters(Me.ListAdapters.SelectedIndex) Me.LableDownloadValue.Text = [String].Format("{0:n} kbps", adapter.DownloadSpeedKbps) Me.LabelUploadValue.Text = [String].Format("{0:n} kbps", adapter.UploadSpeedKbps) End Sub End Class
Connection Speed in Kbps or Mbps?
sunny123
yeah, can somone convert that C# code to VB..
powerteh
Is there a way to do it in VB or convert that C# code
Fusion54
Simple English please.
LittleSettler
For the firts see this: http://www.codeguru.com/csharp/csharp/cs_network/configurationfilesinis/article.php/c9061/
For the second see this : http://www.codeproject.com/csharp/NetworkMonitorl.asp
Regards.
ShEi
If you see the C# code ... will see how re-write it in VB.NET ;)
C# and VB.NET are diferents ways two use the same base class library an same CLR, using the same classes.
Regards.
davidwii
C# to VB and vice versa online Converter:
http://www.developerfusion.co.uk/utilities/convertvbtocsharp.aspx
ChrisSmith
MP
Private adapters As NetworkAdapter()
Private monitor As NetworkMonitor
Sub GetNetworkMonitor()
monitor = New NetworkMonitor
Me.adapters = monitor.Adapters
If adapters.Length = 0 Then
Me.ListAdapters.Enabled = False
MessageBox.Show("No network adapters found on this computer.")
Return
End If
Me.ListAdapters.Items.AddRange(Me.adapters)
End Sub
Private Sub NetMonitor_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
GetNetworkMonitor()
End Sub
Private Sub ListAdapters_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListAdapters.SelectedIndexChanged
monitor.StopMonitoring()
monitor.StartMonitoring(adapters(Me.ListAdapters.SelectedIndex))
Me.TimerCounter.Start()
End Sub
Private Sub TimerCounter_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TimerCounter.Tick
Dim adapter As NetworkAdapter = Me.adapters(Me.ListAdapters.SelectedIndex)
Me.LableDownloadValue.Text = [String].Format("{0:n} kbps", adapter.DownloadSpeedKbps)
Me.LabelUploadValue.Text = [String].Format("{0:n} kbps", adapter.UploadSpeedKbps)
End Sub
End Class
ShAdeVampirE
you need to be more specific than that
what connection speed
where is this connection coming from
how are you obtaining this connection speed