By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,471 Members | 711 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,471 IT Pros & Developers. It's quick & easy.

how to put Listview new data always on top?

newbiefyke
P: 2
Expand|Select|Wrap|Line Numbers
  1. Private Sub btnADD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnADD.Click
  2.  
  3.  Dim sqlquery As String = "INSERT INTO tbl_history (huser, hin, hout, hdate) VALUES ('" & t1.Text & "','" & Label1.Text & "','" & " t2.Text " & "','" & Label2.Text & "')"
  4.  
  5.         Dim sqlcommand As New OleDbCommand
  6.  
  7.         With sqlcommand
  8.             .CommandText = sqlquery
  9.             .Connection = conn
  10.             .ExecuteNonQuery()
  11.  
  12.         End With
  13.  
  14.         MsgBox("Successfully Added.")
  15.         loadlistview()
  16.  
  17.     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
Mar 12 '14 #1
Share this Question
Share on Google+
1 Reply


Frinavale
Expert Mod 5K+
P: 9,731
In your loadlistview method, use an order by to ensure that the newest items appear where you want them to...

-Frinny
Mar 18 '14 #2

Post your reply

Sign in to post your reply or Sign up for a free account.