Results 1 to 7 of 7

Thread: [RESOLVED] Listview display degree, minutes, seconds

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2024
    Posts
    27

    Resolved [RESOLVED] Listview display degree, minutes, seconds

    How to display degree minutes and seconds in listview items? how to start with it?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,097

    Re: Listview display degree, minutes, seconds

    You need to provide much more detail about your issue. What data are you starting with and what do you expect the result to be? I don't use VB6 but if the ListView is like the .NET WinForms ListView then it simply displays text, so the control itself is irrelevant. It's simply a case of what data you have and how you want it formatted.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2024
    Posts
    27

    Re: Listview display degree, minutes, seconds

    I want to show 100° 10 ' 50 " in the listview. How to add this value in listview with degree symbols ?

  4. #4
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,799

    Re: Listview display degree, minutes, seconds

    I'm having trouble understanding the OP's question as well.

    Do you wish to:
    1. Learn how to use the ListView?
    2. Learn how to write a degree symbol?
    3. Learn how to parse some floating-point number into degrees, minutes, seconds?

    The degree symbol is a standard ANSI character. To print it, just put Chr$(176) into wherever you wish to see it. I made a Form1 with a single label on it (Label1), with the label's font large. Here's the Form1 code:

    Code:
    
    Option Explicit
    
    Private Sub Form_Load()
        Me.Label1.Caption = "123" & Chr$(176)
    End Sub
    
    
    And here's the result:
    Name:  Image1.png
Views: 118
Size:  2.6 KB

    If you want to learn how to use ListView and/or how to parse a floating-point number into degrees,minutes,seconds, I'll leave that to others. That last one has recently been discussed here (at your request).
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  5. #5
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,539

    Re: Listview display degree, minutes, seconds

    If you're just getting started in VB6...MY recommendation is to NOT use the ListView, but rather some sort of grid control. SO much easier ("I" think).
    Sam I am (as well as Confused at times).

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Mar 2024
    Posts
    27

    Re: Listview display degree, minutes, seconds

    I have problem to show minutes and seconds symbol in listview. I got like this

    Attachment 191210

    Code:
    With ListView1.ColumnHeaders
    
    .Add , , "POINT", Width / 5, lvwColumnLeft
    .Add , , "ANGLE", Width / 5, lvwColumnCenter
    
    End With
    
    a = 0 + 1
    b = a + 1
    
    
    Set List = ListView1.ListItems.Add(, , a)
    List.SubItems(1) = "123" & Chr$(176) & 40 & Chr$(145) & 50 & Chr$(148)
    
    Set List = ListView1.ListItems.Add(, , b)
    List.SubItems(1) = "100" & Chr$(176) & 30 & Chr$(145) & 10 & Chr$(148)

  7. #7
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,799

    Re: Listview display degree, minutes, seconds

    Wouldn't Chr$(146) be the "minutes" notation you're looking for, not Chr$(145)?

    Also, those are ANSI characters, but they're the single-close-paren and double-close-paren. In this application, it seems like the older typewriter symbols (') and (") might be better. To get a (') into a string, just surround it by double-quotes. To get a double-quote into a string, you can either use Chr$(34) or """" (four double-quote-marks).

    Just to explain """" a bit, once in a string, a double-double-quote ("") will insert a double-quote into your string. So, in """", the first quote starts the string, the 2nd and 3rd insert a double-quote, and the 4th closes the string. Done this way (as opposed to Chr$(34)) makes it a compiler operation, rather than a runtime operation (with a compiler operation being faster).
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width