Jump to content

Datagridview sort by default

- - - - -

  • Please log in to reply
No replies to this topic

#1
tennyis

tennyis

    Newbie

  • Members
  • PipPip
  • 13 posts
I am working on an application for doing quotes for customers. I am using Visual basic 2008 and MS Access database. I have a form that displays all of the current customers. On load it loads tblCustomers into datagridview1. I can add, edit, delete, etc from the datagrid without issue.

I would however like it to sort by columb tblCustomer by default as soon as it is displayed. If I click on the column header then it sorts by that column. Seems like this should be an easy thing to do but I don't see any options. I have tried using "DataGridView1.Sort(DataGridView1.Columns(0))" in form load but to no avail, I am guessing the dgv is not populated yet at that point?

---------- Post added at 02:07 PM ---------- Previous post was at 02:02 PM ----------

ok I got that sorted out, I was missing the information to pass along what order to sort by. But now I am having a new issue. When I start to type in a new record, as soon as I type in the customer name and hit tab, it sorts it. So the list right now is about 150 clients, and if the new client starts with A it's going up to the top before I have a chance to put in the address, phone number, etc.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users