How to get Device Geo-location in C#

Sajjad Arif Gul - March 10, 2016 - 11 comments

How to get Device Location in C# with Longitude & Latitude in C#. This C# tutorial is about getting location of the user in C#.NET using GeoPositionStatus.

First of All you have to add reference to System.Device DLL. If you don’t know How to add a Reference to DLL , Click Here>. But instead of going to Browse option, go to .NET option & Find System.Device. As follows.

Now you will be able to use using System.Device.Location; .Now Add this to your Assemblies. & You are Done. 🙂 .

Source Code:

Here is the main logical code. For the working application, Download from below at the end of article.


Output of this Project is as follows.


Additionally You can also Download this Complete C# Source Code.

Download C# Code for Device Location

I Hope this example will help you out. If you still need any help regarding this program or any other program, Must join our C# Group & Programming Group on Facebook & Comment below to let me know your Problem.

Author avatar

Sajjad Arif Gul
Hi! I am Sajjad Arif Gul, Software Engineer, Web & Mobile Developer from Karachi Pakistan. I love sharing my knowledge that could possibly help someone’s life in some capacity. Happy Coding.

Related posts


  1. Anonymous

    how did you add System.Device?


  2. Bro, I have clearly mention it. check the first step… 😎

  3. Thank you sajjad gul. I am using it in my final year project

  4. Lolz Sajjad Gull ……. Good Effort ………. 🙂

  5. Abdullah.. tusi tay sady senior ho… aap b ay ee bolo gy ?? LOLZ ? :p

  6. Can we use Google Maps API in our windows form application to locate the device ?

  7. Yes . It would be better to that. Bcz sometime user device setting doesnt allow to acces location of device. but in Google Maps, they track your IP so thats a good option.

  8. Anonymous

    Watcher.StatusChanged += Watcher_StatusChanged;

    what this line does?with assignment operator why + has been used?

  9. Celina


    Added the System.Device.Location, but i don’t have the GeoCoordinateWatcher class.
    Do you know what the problem could be?


  10. Erdal Mansuroğlu

    Thanks, Sajjad. The codes you shared worked for me.

Post a Comment

Your email address will not be published. Required fields are marked *