See more:
Hi,
I am using Datagridview with BackgroundWorker in vb.net to simultaneously check the network connectivity status of list of IP addresses and it’s working properly if the Ping status of all IPs is Success but I am getting an error states Object reference not set to an
instance of an object at the 1st IP with Ping status is Timed Out.
Any idea what could be causing it and how I can overcome it?
Your kind support is highly appreciated.
What I have tried:
Below is my full code.
Imports System.ComponentModel
Imports System.Net
Imports System.Net.NetworkInformation
Imports System.Threading
Public Class Form17
Dim Ping As New Ping
Dim i As Integer
Dim reply(i) As PingReply
Private
Sub Form17_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'IPSDataDataSet.IPsConnectionStatus' table. You can move, or remove it, as needed.
Me.IPsConnectionStatusTableAdapter.Fill(Me.IPSDataDataSet.IPsConnectionStatus)
BackgroundWorker1.RunWorkerAsync()
End Sub
Private Sub IPsConnectionStatusBindingNavigatorSaveItem_Click(sender As System.Object, e As System.EventArgs) Handles
IPsConnectionStatusBindingNavigatorSaveItem.Click
Me.Validate()
Me.IPsConnectionStatusBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.IPSDataDataSet)
End Sub
Private Sub BackgroundWorker1_DoWork(sender As System.Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Thread.Sleep(1000)
Me.IPsConnectionStatusDataGridView.DataSource = Me.IPsConnectionStatusBindingSource
Try
ReDim
reply(IPsConnectionStatusDataGridView.RowCount - 1)
For Me.i = 0 To IPsConnectionStatusDataGridView.RowCount - 1
'==================================
reply(i) = Ping.Send(IPsConnectionStatusDataGridView(1, i).Value, 1000)
IPsConnectionStatusDataGridView(2, i).Value = reply(i).Status.ToString
IPsConnectionStatusDataGridView(3, i).Value = reply(i).RoundtripTime
IPsConnectionStatusDataGridView(6, i).Value = reply(i).Address.ToString() 'Address
Next
Catch ex As Exception
MsgBox(ex.Message)
If ex.InnerException IsNot Nothing Then
MsgBox(ex.InnerException)
End If
End Try
End Sub
Private Sub BackgroundWorker1_RunWorkerCompleted(sender As Object, e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted
Try
BackgroundWorker1.RunWorkerAsync()
'========================================================
If IPsConnectionStatusDataGridView(2, i).Value =
"Success" Then
IPsConnectionStatusDataGridView(4, i).Value = Now ' 'Last Succeed On
End If
'================================================================
If IPsConnectionStatusDataGridView(2, i).Value = "TimedOut" Then
IPsConnectionStatusDataGridView(5, i).Value = Now ' 'Last Failed On
End If
Catch ex As Exception
MsgBox(ex.Message)
If ex.InnerException IsNot Nothing Then
MsgBox(ex.InnerException)
End If
End Try
End Sub
End Class
If you are seeing the message "Object reference not set to an instance of an object," reboot your device.
Products affected: SendPro® C Lite, SendPro® C, SendPro®+, SendPro® C Auto (2H00, 8H00, 9H00)
Issue
The message "Object reference not set to an instance of an object" appears when accessing shipping labels.
Cause
Unknown.
Resolution
You may be able to clear the error by restarting the device:
- Unplug the power cable. The screen should turn off after 10 seconds.
- Wait 30 seconds.
- Plug the power cord directly back into a wall outlet. Check that the wall outlet is working correctly.
- Quickly tap and release the power button to turn the device back on.
If you need further assistance, please contact us.
UPDATED: April 22, 2022
- #5
Hello, When I'm trying to make a http request using HTTP VBO, getting exception error message like "Internal : Could not execute code stage because exception thrown by code stage: Object reference not set to an instance of an object." I heard "Object reference not set
to an instance of an object" means object is passing null value to code stage. If yes, how to know which parameter/data item value is null. I cross checked each item, but no luck. Can anyone help me. PS: for better understanding error screenshot is attached. Hi, Thanks
Even i'm also facing the same issue, tried in different ways but no luck as of now. Can you please let me know if you get any solution.