The SUB in form2:
Public Sub soumavez(ByVal varin As Integer)
Try
MessageBox.Show(varin)
Dim pubmapsel As MGMapControl.MGSelection
Dim pubvar2 As MGMapControl.MGMapLayer
Dim pubmapobjectos As MGMapControl.MGCollection
Dim pubmapobj As MGMapControl.MGMapObject
pubmapsel = mgmap.getSelection()
pubvar2 = mgmap.getMapLayer("SIG")
pubmapobjectos = mgmap.createObject("MGCollection")
pubmapobj = mgmap.getMapLayer("SIG").getMapObject(varin)
pubmapobjectos.add(pubmapobj)
mgmap.getSelection().addObjectsEx(pubmapobjectos, False)
mgmap.zoomSelected()
mgmap.zoomScale(mgmap.getLat(), mgmap.getLon(), 1500)
mgmap.refresh()
Catch ex As Exception
MessageBox.Show(ex.Message, "Erro", MessageBoxButtons.OK,
MessageBoxIcon.Error)
End Try
End Sub
this sub is called form Form2 with the following code:
exitvar = DataGridView1.Rows(e.RowIndex).Cells(0).Value
Dim ff As New Form1
ff.BringToFront()
ff.soumavez(exitvar)
PROBLEM:
if i dont put the codeline "MessageBox.Show(varin)", occurs the error at
line "pubmapobj = mgmap.getMapLayer("SIG").getMapObject(varin)".
If i put the message "MessageBox.Show(varin)", occurs the error at line
"mgmap.getSelection().addObjectsEx(pubmapobjectos, False)".
the test that u say to do (call the sub from a buttonclick within Form1)
occurs with NO Error!!!!
Thanks