Maybe is a simple question, but I am not able to find nothing useful for me.
I am trying to debug my program in VB.NET, and I am trying to add an inspection of a comparision. The problem I am having is that the two variables of the comparision are from other forms, so when I try to see the result of the inspection, I am getting the following for both variables:
"reference to a non-shared member requires an object reference vb.net 2010"
My code is:
Private Sub YESButton_Click(sender As Object, e As EventArgs) Handles YESButton.Click
If frmTargetList.delete_Selected_All_targets = 1 Then
'Lo borro de targetListFromBBDD, TARGETS_Overlay, TARGETS_Overlay_Damaged, TARGETS_Overlay_Eliminated, targetMarkers, selectedMultipleTargetclsPosition
For i As Integer = 0 To BMS.targetListFromBBDD.Count - 1
If frmTargetList.targetToDelete = BMS.targetMarkers(i).id Then
BMS.DeleteTargetFromBBDD(BMS.targetMarkers(i).id)
Dim marker As GMarkerGoogle
marker = BMS.targetMarkers(i).marker
BMS.TARGETS_Overlay.Markers.Remove(marker)
BMS.TARGETS_Overlay_Damaged.Markers.Remove(marker)
BMS.TARGETS_Overlay_Eliminated.Markers.Remove(marker)
BMS.targetMarkers.Remove(New clsPosition(marker.ToolTipText, marker.Position.Lat.ToString, marker.Position.Lng.ToString))
BMS.selectedMultipleTargetclsPosition.Remove(New clsPosition(marker.ToolTipText, marker.Position.Lat.ToString, marker.Position.Lng.ToString))
End If
Next
'Lo borro de targetList
For j As Integer = 1 To BMS.targetList.Count
If frmTargetList.targetToDelete = BMS.targetList(j).id Then
BMS.targetList(j) = Nothing
End If
Next
frmTargetList.TargetsListView.SelectedItems(0).Remove()
ElseIf frmTargetList.delete_Selected_All_targets = 2 Then
BMS.TARGETS_Overlay.Markers.Clear()
BMS.TARGETS_Overlay_Damaged.Markers.Clear()
BMS.TARGETS_Overlay_Eliminated.Markers.Clear()
BMS.targetListFromBBDD.Clear()
BMS.targetList.Clear()
BMS.targetMarkers.Clear()
BMS.selectedMultipleTargetclsPosition.Clear()
BMS.targetId = 1
BMS.targetInserted = 0
BMS.DeleteAllTargetFromBBDD()
frmTargetList.TargetsListView.Clear()
BMS.myOverlayDistances.Clear()
End If
Me.Close()
frmTargetList.Close()
End Sub
And in this line:
If frmTargetList.targetToDelete = BMS.targetMarkers(i).id Then
is where I am not able to see what is happening, but the execution does not continue and I can not see why.
If needed, both variables are public, and are declarated in forms that are in the same project. Also, I am checking that during the flow of the program, that variables have value, so I think that the problem is that this variables does not match, but when I execute the program to make them match, neither continues and exit.
There some way to do an inspection of variables that are in other forms?
Thanks to everyone