Network Availability _+ Main Form Status Bar

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?Um9ja3k=?=

    #1

    Network Availability _+ Main Form Status Bar

    If the network cable is unplugged I need to change an image on my main form
    status bar, however this does not work

    ' The computer has been connected or disconnected from the network
    If e.IsNetworkAvai lable = False Then
    My.Forms.MainFo rm.usbtest.Pane ls(2).Appearanc e.Image =
    My.Resources.se rver_error
    Else
    My.Forms.MainFo rm.usbtest.Pane ls(2).Appearanc e.Image =
    My.Resources.se rver_ok
    End If

    If I put the following in the main form load it works fine
    usbtest.Panels( 2).Appearance.I mage = My.Resources.se rver_ok
  • Kevin S Gallagher

    #2
    Re: Network Availability _+ Main Form Status Bar

    My guess is since the network is available the logic in
    MyApplication_N etworkAvailabil ity does not fire as my code acted the same as
    yours.



    Private Sub MyApplication_N etworkAvailabil ityChanged(ByVa l sender As
    Object, ByVal e As Microsoft.Visua lBasic.Devices. NetworkAvailabl eEventArgs)
    Handles Me.NetworkAvail abilityChanged
    SetConnectionSt atus(e.IsNetwor kAvailable)
    End Sub
    Public Sub SetConnectionSt atus(ByVal connected As Boolean)
    If Not (connected) Then
    frmMainForm.Too lStripStatusLab el1.Image = My.Resources.Ne tDown
    Else
    frmMainForm.Too lStripStatusLab el1.Image = My.Resources.Ne tUp
    End If
    End Sub



    Private Sub frmMainForm_Loa d(ByVal sender As System.Object, ByVal e As
    System.EventArg s) Handles MyBase.Load
    If My.Computer.Net work.IsAvailabl e Then
    ToolStripStatus Label1.Image = My.Resources.Ne tUp
    Else
    ToolStripStatus Label1.Image = My.Resources.Ne tDown
    End If
    End Sub

    "Rocky" <Rocky@discussi ons.microsoft.c omwrote in message
    news:F222B62F-F1D1-402A-A8A8-3C38316F9CCC@mi crosoft.com...
    If the network cable is unplugged I need to change an image on my main
    form
    status bar, however this does not work
    >
    ' The computer has been connected or disconnected from the
    network
    If e.IsNetworkAvai lable = False Then
    My.Forms.MainFo rm.usbtest.Pane ls(2).Appearanc e.Image =
    My.Resources.se rver_error
    Else
    My.Forms.MainFo rm.usbtest.Pane ls(2).Appearanc e.Image =
    My.Resources.se rver_ok
    End If
    >
    If I put the following in the main form load it works fine
    usbtest.Panels( 2).Appearance.I mage = My.Resources.se rver_ok

    Comment

    • =?Utf-8?B?Um9ja3k=?=

      #3
      Re: Network Availability _+ Main Form Status Bar

      It does fire, I think the problem is accessing the main form.

      "Kevin S Gallagher" wrote:
      My guess is since the network is available the logic in
      MyApplication_N etworkAvailabil ity does not fire as my code acted the same as
      yours.
      >
      >
      >
      Private Sub MyApplication_N etworkAvailabil ityChanged(ByVa l sender As
      Object, ByVal e As Microsoft.Visua lBasic.Devices. NetworkAvailabl eEventArgs)
      Handles Me.NetworkAvail abilityChanged
      SetConnectionSt atus(e.IsNetwor kAvailable)
      End Sub
      Public Sub SetConnectionSt atus(ByVal connected As Boolean)
      If Not (connected) Then
      frmMainForm.Too lStripStatusLab el1.Image = My.Resources.Ne tDown
      Else
      frmMainForm.Too lStripStatusLab el1.Image = My.Resources.Ne tUp
      End If
      End Sub
      >
      >
      >
      Private Sub frmMainForm_Loa d(ByVal sender As System.Object, ByVal e As
      System.EventArg s) Handles MyBase.Load
      If My.Computer.Net work.IsAvailabl e Then
      ToolStripStatus Label1.Image = My.Resources.Ne tUp
      Else
      ToolStripStatus Label1.Image = My.Resources.Ne tDown
      End If
      End Sub
      >
      "Rocky" <Rocky@discussi ons.microsoft.c omwrote in message
      news:F222B62F-F1D1-402A-A8A8-3C38316F9CCC@mi crosoft.com...
      If the network cable is unplugged I need to change an image on my main
      form
      status bar, however this does not work

      ' The computer has been connected or disconnected from the
      network
      If e.IsNetworkAvai lable = False Then
      My.Forms.MainFo rm.usbtest.Pane ls(2).Appearanc e.Image =
      My.Resources.se rver_error
      Else
      My.Forms.MainFo rm.usbtest.Pane ls(2).Appearanc e.Image =
      My.Resources.se rver_ok
      End If

      If I put the following in the main form load it works fine
      usbtest.Panels( 2).Appearance.I mage = My.Resources.se rver_ok
      >
      >
      >

      Comment

      Working...