Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Mobile
  4. Decimal numbers and Devices languages. [modified]

Decimal numbers and Devices languages. [modified]

Scheduled Pinned Locked Moved Mobile
helpdatabasevisual-studiotutorialquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hurricane3000
    wrote on last edited by
    #1

    Hi all, I written the below code with the purpose to sort several string-arrays and two ComboBox.Items. It's important to precise that I only want to change the order with witch them are stored (in arrays) or displayed in ComboBox.Items (not to sort them alphabetically). It's also important to precise for Lat1 and Lon1, I input them in TextBox3, using the "." (dot) separator. Using ",", return me an error. Well, the following code works perfectly (as I espected from it) in emulator of English VS 2005, but doesn't works perfectly in real device (PPC Windows mobile 2003 SE). I obtain in ComboBoxes. items a not correct and different order of items. I am almost sure that cause of the problem is the different Language of device (Italian) because the logic of the code is correct, but I don't know how to resolve it. Italian language use the comma "," as decimal delimitator, instead of the dot. Can someone help me, please? Thanks Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click Dim Lat1, Lon1, Lat2, Lon2 As Double Distances = New Single(LatsWpt.GetLength(0) - 1) {} Dim Distance As Single Dim Index As Integer Dim NRow As Integer Dim LatString As String = "" Dim LonString As String = "" For Counter = 1 To Len(TextBox3.Text) If Microsoft.VisualBasic.Mid(TextBox3.Text, Counter, 1) <> " " Then LatString = LatString + Microsoft.VisualBasic.Mid(TextBox3.Text, Counter, 1) Else Exit For Next For Counter = Counter + 1 To Len(TextBox3.Text) If Microsoft.VisualBasic.Mid(TextBox3.Text, Counter, 1) <> " " Then LonString = LonString + Microsoft.VisualBasic.Mid(TextBox3.Text, Counter, 1) Next Lat1 = Val(LatString) Lon1 = Val(LonString) For Index = 1 To LatsWpt.GetLength(0) - 1 Lat2 = LatsWpt(Index) Lon2 = LongsWpt(Index) Distance = (6371 * 3.1415926 * Math.Sqrt((Lat2 - Lat1) * (Lat2 - Lat1) + Math.Cos(Lat2 / 57.29578) * Math.Cos(Lat1 / 57.29578) * (Lon2 - Lon1) * (Lon2 - Lon1)) / 180) Distances(Index) = Distance Next For Index = Distances.GetLength(0) - 1 To 1 Step -1 For Counter = 1 To Index If Distances(Counter) > Distances(0) Then Distances(0) = Distances(Counter) : NRow = Counter Next Distances(NRow) = Distances(Index) : Distances(Index) = Distances(0) :

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups