473,322 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

how to put Listview new data always on top?

newbiefyke
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
1 1217
Frinavale
9,735 Expert Mod 8TB
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

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

Similar topics

0
by: Zac Maclean | last post by:
I have a working version of this in VB, tryign to translate everything over to C#. In the C# version this is filling the listview, the first couple columns are ok, but the last few are going...
2
by: MikeY | last post by:
Hi all, I am coding window forms in C#. My problem is this: I have created a "Check ListView" or a 'ListView' with checkbox's. I have populated the it with my files from my folders, mps, txt,...
0
by: alan | last post by:
Dear all, I'm trying to do a data binding for a ListView and I rewrite the code from some example but there is a error while I execute. Can anybody tell me what's wrong with it?? Thank you!! ...
6
by: Beginner | last post by:
Hi, I'm trying to populate a TreeView from an existing and filled in ListView (lvwBuild). lvwBuild is a basic two column listview which can have any number of rows. I would like the first...
3
by: piercy | last post by:
Hi, i am trying to use a list view to display a list of passed and failed items but the images are not always displaying. Sometimes the images will display fine and others they just will not appear....
2
by: michael b | last post by:
i always got the empty string in form data posting. can you describe what the hell happened in my code? always got the empty string to insert to SQL server even it is drop down list selected value is...
2
by: lenniekuah | last post by:
Hello Friends, I am using C#NET2008, Window Application with LISTVIEW. I encounter an interesting problem while trying to retrieve 2 ListView SubItem column data of ORDERDATE and INVOICE for...
7
by: copleyuk | last post by:
I have a database with a number of users entering data into an SQL database from a form. The form is set so that when entering data, if a reference number has already been used the form will...
1
by: sigridish | last post by:
i already know how to save in excel using openfiledialog. but what i want to happen is that when i save another file, i want it to be saved in my existing file but in a different sheet. can you guys...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.