Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8907953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:03:06+00:00 2026-06-15T03:03:06+00:00

My question is a duplicate of this one: geocoding address into coordinates with the

  • 0

My question is a duplicate of this one: geocoding address into coordinates
with the only difference being that I need to do it in Monotouch (C#) not Objective-C.

I’ve tried this so far with no success:

string sw = searchWhere.Text;  
CLGeocoder clg = new CLGeocoder();  
clg.GeocodeAddress(sw, HandleCLGeocodeCompletionHandler);

EDIT: The CompletionHandler is called, but I dont know how to get the new Map app to show. (I am very new to iOS dev.)

    MKMapView MapIt = new MKMapView();
    void HandleCLGeocodeCompletionHandler (CLPlacemark[] placemarks, NSError error)
    {

        List<ObjAnnotation> oal = new List<ObjAnnotation>();

        if ( oal.Count > 0 )
        {
            MapIt.RemoveAnnotations(oal.ToArray()); 
        }
        oal.Clear();
        for(int i = 0; i < placemarks.Length; i++)
        {
            var loc = placemarks[i].Location.Coordinate;
            oal.Add(new ObjAnnotation(new CLLocationCoordinate2D(loc.Latitude, loc.Longitude),
                                      placemarks[i].Name, string.Empty));
        }
        MapIt.AddAnnotationObjects(oal.ToArray());
        CustomerDetailTab cdt = CustomerDetailTab;
        UIView view = cdt.View;
        MapIt.AddSubview (view);
    }

The line CustomerDetailTab cdt = CustomerDetailTab; does not build though. I am having trouble understanding how to get the view object.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:03:07+00:00Added an answer on June 15, 2026 at 3:03 am

    Got it working thusly:

    partial void btnAddr1Touch (MonoTouch.Foundation.NSObject sender)
            {
    
            short version =  Convert.ToInt16(UIDevice.CurrentDevice.SystemVersion.Split('.')[0] );
            string lmapLocation = Globals.SelectedCustomer.DelAddr01 + " " + Globals.SelectedCustomer.DelAddr02 + " " + Globals.SelectedCustomer.DelAddr03 + " " + Globals.SelectedCustomer.DelAddr04 + " " + Globals.SelectedCustomer.DelAddr05;
            mapLocation= Globals.SelectedCustomer.DelAddr01 + Environment.NewLine + Globals.SelectedCustomer.DelAddr02 + Environment.NewLine + Globals.SelectedCustomer.DelAddr03 + Environment.NewLine + Globals.SelectedCustomer.DelAddr04 + Environment.NewLine + Globals.SelectedCustomer.DelAddr05;
    
    
            if(mapLocation.Trim().Length == 0)return;
    
            if (version == 5) 
            {
                NSUrl url = new NSUrl("http://maps.google.com/maps?q=" + lmapLocation);
                UIApplication.SharedApplication.OpenUrl(url);
            }               
            else 
            {   
                ActivityThread.Start ("Loading Location");
                string sw = mapLocation;
                CLGeocoder clg = new CLGeocoder();
                clg.GeocodeAddress(sw, HandleCLGeocodeCompletionHandler);
    
            }
        }
    
    void HandleCLGeocodeCompletionHandler (CLPlacemark[] placemarks, NSError error)
            {
                try 
                {
                    CLLocationCoordinate2D coordinate = placemarks [0].Location.Coordinate;
    
                viewController = new MapViewController (coordinate, Globals.SelectedCustomer.Name, mapLocation);
    
                ActivityThread.Stop ();
                this.NavigationController.PushViewController (viewController, true);
            } 
            catch (Exception ex) 
            {
                ActivityThread.Stop ();
                var erroralert = new UIAlertView ("Location could not be found", "", null, "Ok", null);
                erroralert.Show ();
            }
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Title borrowed from this question , of which this one is not a duplicate.
This may be duplicate question but I could not find one on SO. If
I am not sure if this is a duplicate question to this one mainly
This question is related to this one , but is not a duplicate. Jb
This question is similar to this one , but not a duplicate because I'm
I don't think my question is a duplicate of this one . what I
This could be considered a duplicate question, as a similar one has already been
I agree that this question is duplicate. Please bear with me. I was also
This is NOT a duplicate question, and the problem is driving me crazy. I
This one's perhaps a duplicate of variable not recognized inside contentscript under the same

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.