how to put Listview new data always on top?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • newbiefyke
    New Member
    • Mar 2014
    • 2

    how to put Listview new data always on top?

    Code:
    Private Sub btnADD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnADD.Click
    
     Dim sqlquery As String = "INSERT INTO tbl_history (huser, hin, hout, hdate) VALUES ('" & t1.Text & "','" & Label1.Text & "','" & " t2.Text " & "','" & Label2.Text & "')"
    
            Dim sqlcommand As New OleDbCommand
    
            With sqlcommand
                .CommandText = sqlquery
                .Connection = conn
                .ExecuteNonQuery()
    
            End With
    
            MsgBox("Successfully Added.")
            loadlistview()
            
        End Sub
    'this is my code when adding NEW data to ms Access
    I can add new data to MS Access
    it will also show in my Listview however it is located at the bottom part.

    I wish that the new data/record will show on top/first row
    Last edited by newbiefyke; Mar 12 '14, 02:23 PM. Reason: did not use code option
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    In your loadlistview method, use an order by to ensure that the newest items appear where you want them to...

    -Frinny

    Comment

    Working...