-
Apr 18th, 2024, 12:44 AM
#1
Thread Starter
Junior Member
[RESOLVED] Listview display degree, minutes, seconds
How to display degree minutes and seconds in listview items? how to start with it?
-
Apr 18th, 2024, 01:21 AM
#2
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.
-
Apr 18th, 2024, 07:26 AM
#3
Thread Starter
Junior Member
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 ?
-
Apr 18th, 2024, 08:43 AM
#4
Re: Listview display degree, minutes, seconds
I'm having trouble understanding the OP's question as well.
Do you wish to:
- Learn how to use the ListView?
- Learn how to write a degree symbol?
- 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:

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.
-
Apr 18th, 2024, 12:55 PM
#5
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).
-
Apr 18th, 2024, 07:44 PM
#6
Thread Starter
Junior Member
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)
-
Apr 19th, 2024, 07:10 AM
#7
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|