Thread: Need some help!

Results 1 to 10 of 10
  1. #1
    cook91c's Avatar
    Join Date
    Jul 2011
    Gender
    male
    Posts
    34
    Reputation
    10
    Thanks
    1
    My Mood
    Bored

    Need some help!

    I'm trying to make a longitude and latitude converter. I use Google maps to get longitude and latitude for my handheld GPS but there longitude and latitude is a different type then my GPS uses. I have to convert it before putting it in my GPS. I made a very simple program using VB 2008 that open up right to Google maps and at the top of the program i want to put the converter. I have done a lot of research and still i am not able to wright a code that will do the conversion. For the conversion Need to multiply the decimal part of the longitude and latitude by 60
    For example if i had 40.313043,-97.573244 I would multiply .313043 by 60 witch = 18.78258 and then i would multiply .573244 by 60 witch = 34.39464
    The finale longitude and latitude would be 40 18.782, 97 34.394
    If anyone could help me wright a code to do this or give me a few tips it would be much appreciated


    [IMG]https://i1194.photobucke*****m/albums/aa375/c91c/CF_Logo.png[/IMG]

  2. #2
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    You weren't exactly clear on what to do with the part you multiply by 60, it looks like you just appended it with a space?

    Code:
    Private Shared Function CorrectInput(ByVal arg As Double) As String
        Dim dec As Double = 60 * (arg - (arg \ 1))
        Return (arg \ 1).ToString() + " " + dec.ToString()
    End Function
    Example:

    Code:
    Dim raw As Double = 40.313043
    MessageBox.Show(CorrectInput(raw))
    'messagebox will popup "40 18.75258"

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  3. #3
    cook91c's Avatar
    Join Date
    Jul 2011
    Gender
    male
    Posts
    34
    Reputation
    10
    Thanks
    1
    My Mood
    Bored
    I took a screen shot of my program to help explain i want to do. i want to be able to put the longitude and latitude in the first text box and i want to be able to get the answer in the second text box
    https://i1118.photobucke*****m/albums/...botter/gps.jpg
    Last edited by cook91c; 11-25-2011 at 12:39 PM.


    [IMG]https://i1194.photobucke*****m/albums/aa375/c91c/CF_Logo.png[/IMG]

  4. #4
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Why does it convert a negative number to a positive number?

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  5. #5
    cook91c's Avatar
    Join Date
    Jul 2011
    Gender
    male
    Posts
    34
    Reputation
    10
    Thanks
    1
    My Mood
    Bored
    Quote Originally Posted by Jason View Post
    Why does it convert a negative number to a positive number?
    It converts it to a positive number because because its going from a Latitude/Longitude that uses degrees to a Latitude/Longitude that uses north, south, east, and west


    [IMG]https://i1194.photobucke*****m/albums/aa375/c91c/CF_Logo.png[/IMG]

  6. #6
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Alright so something like:

    Code:
        Private Function ConvertValue(ByVal arg As Double) As String
            arg = Math.Abs(arg)
            Dim intval As Integer = CType(Math.Floor(arg), Integer)
            Return intval.ToString() + " " + (60 * (arg - intval)).ToString()
        End Function
    Should do the job?

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  7. The Following User Says Thank You to Jason For This Useful Post:

    cook91c (11-26-2011)

  8. #7
    cook91c's Avatar
    Join Date
    Jul 2011
    Gender
    male
    Posts
    34
    Reputation
    10
    Thanks
    1
    My Mood
    Bored
    Code:
    Public Class Form1
    
       Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            WebBrowser1.Url = New Uri("https://maps.google.com/?ie=UTF8&t=h&vpsrc=0&ll=37.09024,-95.712891&spn=33.435463,56.25/")
        End Sub
        Private Function ConvertValue(ByVal arg As Double) As String
            arg = Math.Abs(arg)
            Dim Latitude As Integer = CType(Math.Floor(arg), Integer)
            Return Latitude.ToString() + " " + (60 * (arg - Latitude)).ToString()
        End Function
        Private Function ConvertValue2(ByVal arg As Double) As String
            arg = Math.Abs(arg)
            Dim Longitude As Integer = CType(Math.Floor(arg), Integer)
            Return Longitude.ToString() + " " + (60 * (arg - Longitude)).ToString()
        End Function
    OK this what I have and i think i got it right but how do I get the results from ConvertValue and ConvertValue2 to show up in text boxes or labels


    [IMG]https://i1194.photobucke*****m/albums/aa375/c91c/CF_Logo.png[/IMG]

  9. #8
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    You don't need to create the function twice with different names:

    Code:
    Private Function ConvertValue(ByVal arg As Double) As String
        arg = Math.Abs(arg)
        Dim intval As Integer = CType(Math.Floor(arg), Integer)
        Return intval.ToString() + " " + (60 * (arg - intval)).ToString()
    End Function
    
    Private Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click
        TextBox1.Text = ConvertValue(47.343924) 
        TextBox2.Text = ConvertValue(-97.323132)
    End Sub

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  10. #9
    cook91c's Avatar
    Join Date
    Jul 2011
    Gender
    male
    Posts
    34
    Reputation
    10
    Thanks
    1
    My Mood
    Bored
    I changed it from a Latitude/Longitude textbox to a text box for Latitude and one for Longitude. So wouldn't i need the function twice? Also with
    Code:
    TextBox1.Text = ConvertValue(47.343924) 
        TextBox2.Text = ConvertValue(-97.323132)
    it will always come up with 47.3439924 and -97.323132.
    what i want it to do is the conversion for what ever i put in the textbox1 and textbox2 and i want the converted Latitude/Longitude to end up in textbox3 textbox4


    [IMG]https://i1194.photobucke*****m/albums/aa375/c91c/CF_Logo.png[/IMG]

  11. #10
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    I know, use some initiative and change 47/-97 to some textbox values or something, I can't do EVERYTHING for you.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

Similar Threads

  1. [Help Request] Need some help with my server premisions
    By pero122 in forum Minecraft Help
    Replies: 5
    Last Post: 11-07-2011, 10:55 PM
  2. [Help Request] Need some help to make a bot
    By Domo in forum Vindictus Help
    Replies: 6
    Last Post: 05-21-2011, 10:15 AM
  3. [Help Request] I need some help with binding eps7
    By v1zhaixingv1 in forum Vindictus Help
    Replies: 3
    Last Post: 05-18-2011, 09:25 PM
  4. need some help with client exe.
    By barney in forum Hack Requests
    Replies: 2
    Last Post: 11-03-2006, 10:05 PM
  5. my sig is done but i need some help
    By A7X Oblivian in forum Help & Requests
    Replies: 0
    Last Post: 02-21-2006, 12:24 AM