NetworkAvailabilityChanged event not recognized.

  • Thread starter Thread starter Anil Gupte/iCinema.com
  • Start date Start date
A

Anil Gupte/iCinema.com

Private Sub MyApplication_NetworkAvailabilityChanged(ByVal sender As Object,
ByVal e As NetworkAvailableEventArgs) Handles Me.NetworkAvailabilityChanged

End Sub

How do I get the above to work? It does not seem to recognize the
NetworkAvailabilityChanged event

I have used the following as well, and it removed one of the errors, but the
event is still not recognized.
Imports Microsoft.VisualBasic.Devices

Imports Microsoft.VisualBasic.ApplicationServices

I got this from a web page: http://www.codeproject.com/KB/vb/vb2005ga.aspx

Thanx,
 
Anil said:
Private Sub MyApplication_NetworkAvailabilityChanged(ByVal sender As
Object, ByVal e As NetworkAvailableEventArgs) Handles
Me.NetworkAvailabilityChanged
End Sub

How do I get the above to work? It does not seem to recognize the
NetworkAvailabilityChanged event

I have used the following as well, and it removed one of the errors,
but the event is still not recognized.
Imports Microsoft.VisualBasic.Devices

Imports Microsoft.VisualBasic.ApplicationServices

I got this from a web page:
http://www.codeproject.com/KB/vb/vb2005ga.aspx
Thanx,

I would drop the My.* overhead and directly subscribe to the
System.Net.NetworkInformation.NetworkChange.NetworkAvailabilityChanged
event. Maybe that works.


Armin
 
Private Sub MyApplication_NetworkAvailabilityChanged(ByVal sender As Object,
ByVal e As NetworkAvailableEventArgs) Handles Me.NetworkAvailabilityChanged

End Sub

How do I get the above to work?  It does not seem to recognize the
NetworkAvailabilityChanged event

I have used the following as well, and it removed one of the errors, but the
event is still not recognized.
Imports Microsoft.VisualBasic.Devices

Imports Microsoft.VisualBasic.ApplicationServices

I got this from a web page:http://www.codeproject.com/KB/vb/vb2005ga.aspx

Thanx,

Hi Anil,
To handle NetworkAvailabilityChanged event, you need to put event
handler into MyApplication partial friend class. To do that, follow
project properties->Application Tab and click "View Application
Events". ApplicationEvents.vb will be opened. Then place the code here
to handle that event. The whole code will look like this:

Imports Microsoft.VisualBasic.Devices
Namespace My

Partial Friend Class MyApplication
Private Sub MyApplication_NetworkAvailabilityChanged(ByVal
sender As Object, ByVal e As NetworkAvailableEventArgs) Handles
Me.NetworkAvailabilityChanged
' Handle the event here
End Sub
End Class

End Namespace

For more info:
http://msdn.microsoft.com/en-us/lib...networkchange.networkavailabilitychanged.aspx
http://msdn.microsoft.com/en-us/library/4y6b9c17(VS.80).aspx
http://vbnotebookfor.net/index.php?s=networkavailabilitychanged

Hope this helps,

Onur Güzel
 
Thanx, that helped. In fact I also realized I had overlooked the
instruction to check the "Enable Application Framework". I have it turnedd
off and I am not sure I want to turn it on at this stage in my development
because it may introduce some unknown bugs o instability in my app.

Is there no other way to access this event?

Thanx,
--
Anil Gupte
www.keeninc.net
www.icinema.com
www.wizo.tv
Private Sub MyApplication_NetworkAvailabilityChanged(ByVal sender As
Object,
ByVal e As NetworkAvailableEventArgs) Handles
Me.NetworkAvailabilityChanged

End Sub

How do I get the above to work? It does not seem to recognize the
NetworkAvailabilityChanged event

I have used the following as well, and it removed one of the errors, but
the
event is still not recognized.
Imports Microsoft.VisualBasic.Devices

Imports Microsoft.VisualBasic.ApplicationServices

I got this from a web page:http://www.codeproject.com/KB/vb/vb2005ga.aspx

Thanx,

Hi Anil,
To handle NetworkAvailabilityChanged event, you need to put event
handler into MyApplication partial friend class. To do that, follow
project properties->Application Tab and click "View Application
Events". ApplicationEvents.vb will be opened. Then place the code here
to handle that event. The whole code will look like this:

Imports Microsoft.VisualBasic.Devices
Namespace My

Partial Friend Class MyApplication
Private Sub MyApplication_NetworkAvailabilityChanged(ByVal
sender As Object, ByVal e As NetworkAvailableEventArgs) Handles
Me.NetworkAvailabilityChanged
' Handle the event here
End Sub
End Class

End Namespace

For more info:
http://msdn.microsoft.com/en-us/lib...networkchange.networkavailabilitychanged.aspx
http://msdn.microsoft.com/en-us/library/4y6b9c17(VS.80).aspx
http://vbnotebookfor.net/index.php?s=networkavailabilitychanged

Hope this helps,

Onur Güzel
 
Thanx, that helped.  In fact I also realized I had overlooked the
instruction to check the "Enable Application Framework".  I have it turnedd
off and I am not sure I want to turn it on at this stage in my development
because it may introduce some unknown bugs o instability in my app.

Is there no other way to access this event?

Thanx,
--








Hi Anil,
To handle NetworkAvailabilityChanged event, you need to put event
handler into MyApplication partial friend class. To do that, follow
project properties->Application Tab and click "View Application
Events". ApplicationEvents.vb will be opened. Then place the code here
to handle that event. The whole code will look like this:

Imports Microsoft.VisualBasic.Devices
Namespace My

Partial Friend Class MyApplication
        Private Sub MyApplication_NetworkAvailabilityChanged(ByVal
sender As Object, ByVal e As NetworkAvailableEventArgs) Handles
Me.NetworkAvailabilityChanged
            ' Handle the event here
        End Sub
    End Class

End Namespace

For more info:http://msdn.microsoft.com/en-us/lib...or.net/index.php?s=networkavailabilitychanged

Hope this helps,

Onur Güzel

Hi,
As MSDN says:
"The code for the NetworkAvailabilityChanged event handler is stored
in the ApplicationEvents.vb file, which is hidden by default.", so the
code for NetworkAvailabilityChanged event must be located in
ApplicationEvents.vb file.

However, you still have a chance to test network availability without
being forced to put the following code into ApplicationEvents.vb
using:
' Eg: In your Form class
My.Computer.Network.IsAvailable property.

Hope that helps,

Onur Güzel
 
I replied, and I tried what you sugested, but that did not work. I will try
it again and tell you the results.

Thanx,
 
Back
Top