how to define the buffer distance

534
2
06-28-2012 02:07 AM
YassineEL_JADIDI
New Contributor
hi,
i applied the buffer sample http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#BufferQuery.
but i want to define the buffer distance before click in the map. i created a textbox where i can enter the distance but in the code behind..it give me an error :
my code
  var distancebuffer = txtbuffer.Text;
            
            bufferParams.Distances.Add(distancebuffer);

the error :
- Error : Argument 1: cannot convert from 'string' to 'double'
- Error : The best overloaded method match for 'System.Collections.Generic.List<double>.Add(double)' has some invalid arguments
0 Kudos
2 Replies
JoeHershman
MVP Regular Contributor
txtBuffer.Text is a string you need to pass a double to the method, that is why the error says you are passing a string where a double is required.



  double distancebuffer = double.Parse(txtbuffer.Text);          
  bufferParams.Distances.Add(distancebuffer);



(perhaps at some point you could thank someone on this forum who offers you help)
Thanks,
-Joe
0 Kudos
YassineEL_JADIDI
New Contributor
Thank you too much minerjoe for your reply...it's ok now !
and im sorry if i didn't thank you in others topics...my apologizes !
0 Kudos