Hi. I am working on this ftp client and i want a column of the listview to show the date modified. I've got the code but here's the problem:

Private Sub RefreshList()
        FTPDownload.Hostname = LoginMenu.TextBox3.Text.Trim
        FTPDownload.Username = LoginMenu.TextBox1.Text
        FTPDownload.Password = LoginMenu.TextBox2.Text
            For Each File In FTPDownload.ListDirectory
                Dim ext As String = IO.Path.GetExtension(File)
                Dim ftp1 As Net.FtpWebRequest = Net.FtpWebRequest.Create(LoginMenu.TextBox3.Text & ToolStripStatusLabel2.Text & ToolStripStatusLabel5.Text)
                ftp1.Credentials = New NetworkCredential(LoginMenu.TextBox1.Text, LoginMenu.TextBox2.Text)
                ftp1.Method = Net.WebRequestMethods.Ftp.GetDateTimestamp
                Dim dte As DateTime
                Using response1 = CType(ftp1.GetResponse(), Net.FtpWebResponse)
                    dte = response1.LastModified
                    ListView1.Items.Add(New ListViewItem({File, ext, dte}))
                End Using

        Catch ex As Exception
        End Try
    End Sub

I made another sub and that goes into listview click. Each time i click an item in the listview it shows the date but when the form loads the RefreshList() sub nothing happens. It doesn't show the modified dates...

Can someone help me please :)

Make the dte variable a String and convert the LastModified time to a String


Dim dte as String
Using response1 = CType(ftp1.GetResponse(), Net.FtpWebResponse)
    dte = response1.LastModified.ToString("dd/MM/yyyy")
    ListView1.Items.Add(New ListViewItem({File, ext, dte}))
End Using

Edited 3 Years Ago by Ketsuekiame

Try this:

Dim item1 As New ListViewItem(File)
This article has been dead for over six months. Start a new discussion instead.