Formatting Column in List View 
Author Message
 Formatting Column in List View

No matter how I try to manipulate the code, the date
format is coming in as "10/02/2002 10:00:00 PM"

What can I do to format a simple column?  Even if I make
it a string cutting out the extra into ie "10/02/02"
it still comes in incorrectly.  Help!

If IsDBNull(.Item("author_time")) Then
               lv.Items(i).SubItems.Add("")
            Else
               Dim c As Date
               Dim s As String
               's = Microsoft.VisualBasic.Left(.Item
("author_date"), 6)
               's = s & Microsoft.VisualBasic.Right(.Item
("author_date"), 2)
               s = FormatDateTime(.Item("author_date"),
DateFormat.ShortDate) & " " & .Item("author_time")
               c = CDate(s)
               'c = .Item("author_date") & " " & .Item
("author_time")
               'c = (Format(c, "M/dd/yy H:mm"))
               lv.Items(i).SubItems.Add(c)
               ' lv.Items(i).SubItems.Add(.Item
("author_date") & " " & (Format(.Item
("author_time"), "MM/dd/YY HH:mm")))
            End If



Mon, 18 Apr 2005 01:57:19 GMT  
 Formatting Column in List View
Angel,
    How about just
c.ToString("MM/dd/yy HH:mm")
to format the whole DateTime?
Ron Allen

Quote:
> No matter how I try to manipulate the code, the date
> format is coming in as "10/02/2002 10:00:00 PM"

> What can I do to format a simple column?  Even if I make
> it a string cutting out the extra into ie "10/02/02"
> it still comes in incorrectly.  Help!

> If IsDBNull(.Item("author_time")) Then
>                lv.Items(i).SubItems.Add("")
>             Else
>                Dim c As Date
>                Dim s As String
>                's = Microsoft.VisualBasic.Left(.Item
> ("author_date"), 6)
>                's = s & Microsoft.VisualBasic.Right(.Item
> ("author_date"), 2)
>                s = FormatDateTime(.Item("author_date"),
> DateFormat.ShortDate) & " " & .Item("author_time")
>                c = CDate(s)
>                'c = .Item("author_date") & " " & .Item
> ("author_time")
>                'c = (Format(c, "M/dd/yy H:mm"))
>                lv.Items(i).SubItems.Add(c)
>                ' lv.Items(i).SubItems.Add(.Item
> ("author_date") & " " & (Format(.Item
> ("author_time"), "MM/dd/YY HH:mm")))
>             End If



Tue, 19 Apr 2005 02:18:46 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Display Bitmaps in Sub Items and column Headers of List View During Report View

2. List View Column - - Possible items in a Single Column

3. List View Columns

4. Sorting the content of list view on clicking column headers

5. Icons in List View Columns

6. List View Column Headers

7. List View Column Sizes

8. Column width of List view

9. List View Column Sorting

10. List View Columns

11. List View click on header to sort date column

12. List View Column Headings

 

 
Powered by phpBB® Forum Software