473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

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.IsNetworkAvailable = False Then
My.Forms.MainForm.usbtest.Panels(2).Appearance.Ima ge =
My.Resources.server_error
Else
My.Forms.MainForm.usbtest.Panels(2).Appearance.Ima ge =
My.Resources.server_ok
End If

If I put the following in the main form load it works fine
usbtest.Panels(2).Appearance.Image = My.Resources.server_ok
Aug 1 '07 #1
2 2856
My guess is since the network is available the logic in
MyApplication_NetworkAvailability does not fire as my code acted the same as
yours.

Private Sub MyApplication_NetworkAvailabilityChanged(ByVal sender As
Object, ByVal e As Microsoft.VisualBasic.Devices.NetworkAvailableEven tArgs)
Handles Me.NetworkAvailabilityChanged
SetConnectionStatus(e.IsNetworkAvailable)
End Sub
Public Sub SetConnectionStatus(ByVal connected As Boolean)
If Not (connected) Then
frmMainForm.ToolStripStatusLabel1.Image = My.Resources.NetDown
Else
frmMainForm.ToolStripStatusLabel1.Image = My.Resources.NetUp
End If
End Sub

Private Sub frmMainForm_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If My.Computer.Network.IsAvailable Then
ToolStripStatusLabel1.Image = My.Resources.NetUp
Else
ToolStripStatusLabel1.Image = My.Resources.NetDown
End If
End Sub

"Rocky" <Ro***@discussions.microsoft.comwrote in message
news:F2**********************************@microsof t.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.IsNetworkAvailable = False Then
My.Forms.MainForm.usbtest.Panels(2).Appearance.Ima ge =
My.Resources.server_error
Else
My.Forms.MainForm.usbtest.Panels(2).Appearance.Ima ge =
My.Resources.server_ok
End If

If I put the following in the main form load it works fine
usbtest.Panels(2).Appearance.Image = My.Resources.server_ok

Aug 1 '07 #2
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_NetworkAvailability does not fire as my code acted the same as
yours.

Private Sub MyApplication_NetworkAvailabilityChanged(ByVal sender As
Object, ByVal e As Microsoft.VisualBasic.Devices.NetworkAvailableEven tArgs)
Handles Me.NetworkAvailabilityChanged
SetConnectionStatus(e.IsNetworkAvailable)
End Sub
Public Sub SetConnectionStatus(ByVal connected As Boolean)
If Not (connected) Then
frmMainForm.ToolStripStatusLabel1.Image = My.Resources.NetDown
Else
frmMainForm.ToolStripStatusLabel1.Image = My.Resources.NetUp
End If
End Sub

Private Sub frmMainForm_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If My.Computer.Network.IsAvailable Then
ToolStripStatusLabel1.Image = My.Resources.NetUp
Else
ToolStripStatusLabel1.Image = My.Resources.NetDown
End If
End Sub

"Rocky" <Ro***@discussions.microsoft.comwrote in message
news:F2**********************************@microsof t.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.IsNetworkAvailable = False Then
My.Forms.MainForm.usbtest.Panels(2).Appearance.Ima ge =
My.Resources.server_error
Else
My.Forms.MainForm.usbtest.Panels(2).Appearance.Ima ge =
My.Resources.server_ok
End If

If I put the following in the main form load it works fine
usbtest.Panels(2).Appearance.Image = My.Resources.server_ok


Aug 1 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Dan Williams | last post by:
Can anyone tell me how to go about creating my own custom ASP page that can show several different peoples availability from their Outlook/Exchange 2000 calendars? I don't want to have to ask...
0
by: jason | last post by:
Hi Everyone, I would really appreciate some thoughts on how best to tackle an availability calender in ASP for our yacht fleet. I need to be able to show the booking STATUS of a particular...
1
by: Hasanain F. Esmail | last post by:
Hi All, I am using A2 for this database. I have a main form with bound fields of FlightNumber and FlightDate I also have a subform. This subform takes details of a passanger along with other...
9
by: William Wisnieski | last post by:
Hello Everyone, Access 2000 I have a main form with a continuous subform. On the main form I have a text field called . It gets populated based on what the user selects in a field on the...
6
by: Christopher C | last post by:
I am currently working on an app the will be a shell replacement. Part of the goal is to list the current network status; basically I need to know if the network card is plugged in. I am currently...
4
by: Jeremy | last post by:
How can I prove uptime (or quantify downtime) on an ASP.NET 1.1 Web application (running on an IIS6 Windows Server Standard server)? What's going on here is that I'm considering the feasability...
3
by: Richard Lewis Haggard | last post by:
I have a form that has a label. This form also has a tab control. The tab control has a user control pasted on its page. Under some conditions, the user control needs to send status strings back to...
8
by: BJ | last post by:
Problem: How can I code up a client side process to detect if the network is available? Synopsis: I am writing ASP.NET input forms for a Panasonic Tuff book. The users will be walking around...
2
by: Folkien | last post by:
Hello everybody. I want to make a little programme to show the network availability status. I read that I had to use Microsoft.VisualBasic.Devices, creat a delegate to manage the event. Here...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.