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:
Output of this Project is as follows.
Download:
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.
how did you add System.Device?
Jason
Bro, I have clearly mention it. check the first step… 😎
Lolz Sajjad Gull ……. Good Effort ………. 🙂
Abdullah.. tusi tay sady senior ho… aap b ay ee bolo gy ?? LOLZ ? :p
Thank you sajjad gul. I am using it in my final year project
You are Welcome.
Can we use Google Maps API in our windows form application to locate the device ?
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.
Watcher.StatusChanged += Watcher_StatusChanged;
what this line does?with assignment operator why + has been used?
Hi,
Added the System.Device.Location, but i don’t have the GeoCoordinateWatcher class.
Do you know what the problem could be?
Thanks
Thanks, Sajjad. The codes you shared worked for me.