thanks for your reply but it&#39;s same in <a href="http://vb.net">vb.net</a> even i do count() it gives the same error<br><br>
<div class="gmail_quote">2009/5/26 Chris Claydon <span dir="ltr">&lt;<a href="mailto:chris.claydon@autodesk.com">chris.claydon@autodesk.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">I&#39;m not too familiar with VB, but don&#39;t you need to call Layers.GetCount() (i.e. using brackets (), since it&#39;s a method)?<br>

<div>
<div></div>
<div class="h5"><br>-----Original Message-----<br>From: <a href="mailto:mapguide-users-bounces@lists.osgeo.org">mapguide-users-bounces@lists.osgeo.org</a> [mailto:<a href="mailto:mapguide-users-bounces@lists.osgeo.org">mapguide-users-bounces@lists.osgeo.org</a>] On Behalf Of <a href="mailto:wakrimsaloua.wakrim@gmail.com">wakrimsaloua.wakrim@gmail.com</a><br>
Sent: Tuesday, May 26, 2009 9:14 AM<br>To: <a href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a><br>Subject: [mapguide-users] prob with GetSelectionXml()<br><br>hi all! i&#39;ve prob with use the xml selection wich i get after user clic on polygone, this is javascript function i use to get selection:(i write it in textfiel and read it by Request.Form:<br>
<br> function test()<br>   {<br><br> k= document.formulaire.classe.value=carte.GetMapFrame().GetSelectionXML();<br><br><br>   }<br><br>for get this selection i use this code<br><br> selectionXml = getValue(&quot;classe&quot;)<br>
<br><br> Private Function getValue(ByVal champ As String) As String<br>       &#39; récupère la valeur du champ [champ] de la requête postée<br>       &#39; qq chose ?<br>       If Request.Form(champ) Is Nothing Then Return &quot;&quot;<br>
       &#39; on récupère la ou les valeurs du champ<br>       Dim valeurs() As String = Request.Form.GetValues(champ)<br>       Dim valeur As String = &quot;&quot;<br>       Dim i As Integer<br>       For i = 0 To valeurs.Length - 1<br>
           valeur += valeurs(i)<br>       Next<br>       valeur = Server.UrlDecode(valeur)<br><br>       Return valeur<br>   End Function<br><br>after user clic on polygone and get xml selection , i use this code for filter and identify polygone ID:<br>
<br> Public Sub getselectionpartiel(ByVal map As MgMap, ByVal resourceService As MgResourceService, ByVal XmlSel As String)<br><br><br>       Dim k = 0<br>          If ((XmlSel &lt;&gt; Nothing) And (XmlSel &lt;&gt; &quot;&quot;)) Then<br>
<br><br>           Dim selection As New MgSelection(map, XmlSel)<br>           Dim Layers As MgReadOnlyLayerCollection = selection.GetLayers()<br><br><br>           If Not Layers.GetCount = 1 Then<br>               Response.Write(&quot;More than one object was selected&quot;)<br>
<br>               Exit Sub<br><br>           End If<br><br><br><br><br><br><br>           Response.Write(&quot;calques selectionnés&quot;)<br><br><br><br>       End If<br><br>   End Sub<br> and i call this function like that:<br>
   getselectionpartiel(map, resourceSrvc, selectionXml)<br><br>it gives me this error:<br><br>&quot;La référence d&#39;objet n&#39;est pas définie à une instance d&#39;un objet.&quot; in the line:<br>(the object reference is not associated to the object instance)<br>
   If Not Layers.GetCount = 1 Then<br><br>i think that Layers is empty but when i display &quot;selectionXml&quot; by using:<br><br>Response.Write(selectionXml) it gives me the correct selection!!!<br>if some one has some idea please tell it me, thanks a lot on advance<br>
<br><br>_______________________________________________<br>mapguide-users mailing list<br><a href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/mailman/listinfo/mapguide-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a><br>
</div></div><br>_______________________________________________<br>mapguide-users mailing list<br><a href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/mailman/listinfo/mapguide-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a><br>
<br></blockquote></div><br>