|
-
Dec 25th, 2005, 03:55 PM
#1
Thread Starter
Addicted Member
-
Dec 25th, 2005, 04:00 PM
#2
Hyperactive Member
Re: Listing in list box
are these numbers you want to sort ot a b c etc ? i have a sample of sorting in list boxes with a - z not sure if it any good
-
Dec 25th, 2005, 04:05 PM
#3
Thread Starter
Addicted Member
Re: Listing in list box
Yes,
I wish it to start from the lowest id number and list accordingly>101,102,103
and if I delete 102 and later enter a new record with id 102 then it will list back
between 101 and 103 in order?
thanks!
-
Dec 25th, 2005, 04:10 PM
#4
Hyperactive Member
Re: Listing in list box
might not be what your looking for but i messaged you it
good luck if someone posts ill sure to copy !
-
Dec 25th, 2005, 11:08 PM
#5
Thread Starter
Addicted Member
Re: Listing in list box
 Originally Posted by Rattled_Cage
might not be what your looking for but i messaged you it
good luck if someone posts ill sure to copy !
No message here rattled? 
Please if you have help to offer post it on the page of the question so all who may need can be helped by it
Last edited by Quizton; Dec 25th, 2005 at 11:32 PM.
-
Dec 26th, 2005, 01:53 AM
#6
Junior Member
Re: Listing in list box
hi
did u use order by clause in youer query? or just show ur code.
Virendrasinh Narendrasinh Mahida
----------------------------------
There is Never a WRONG time to do the RIGHT Thing 
-
Dec 26th, 2005, 02:08 AM
#7
Junior Member
Re: Listing in list box
Hi
You can also do it by setting sorted = true of listbox property
Virendrasinh Narendrasinh Mahida
----------------------------------
There is Never a WRONG time to do the RIGHT Thing 
-
Dec 26th, 2005, 12:51 PM
#8
Thread Starter
Addicted Member
Re: Listing in list box
sorted = true in list sorted by a b c in list anyone know how to sort by id?
thanks
-
Dec 27th, 2005, 03:56 AM
#9
Junior Member
Re: Listing in list box
Have you tried it ??
Just tried and tell me error if any
Virendrasinh Narendrasinh Mahida
----------------------------------
There is Never a WRONG time to do the RIGHT Thing 
-
Dec 27th, 2005, 11:01 AM
#10
Thread Starter
Addicted Member
Re: Listing in list box
yeah I tried the sorted = true but that will sort the box by name and wish to sort by IDno.
-
Dec 27th, 2005, 11:14 AM
#11
Re: Listing in list box
 Originally Posted by Quizton
yeah I tried the sorted = true but that will sort the box by name and wish to sort by IDno.
Is this a ListBox or a ListView?
ListBox will only accept a single item, although you can simulate the addition of multiple items.
Sorting your data should always be done from your SQL query anyway rather than leaving the sorting up to a VB control.
-
Dec 27th, 2005, 11:50 AM
#12
Thread Starter
Addicted Member
Re: Listing in list box
Yes, that is exactly what I am after it is a listbox
My list box only displays the first and last name of the customer and the textboxes display all there info when I click on there name and I also am able to bring up the data by searching for IDno. But what I am after is a code to be sure this listbox will load the first and last names according to IDno. or Least to greatest?
example If SalMartinez was ID 101 then he would be the first to be displayed in list, this is how it was at the start but the real issue here is that if I deleted Sals record and then later entered JohnSmith and assigned him Sals old IDno then John will be automaticaly placed at the bottom of list When I would like him to be the first since 101 is the start or primary key and then list accordingly 101,102,103,ect...
-
Dec 27th, 2005, 12:33 PM
#13
Re: Listing in list box
and then later entered JohnSmith and assigned him Sals old IDno then John will be automaticaly placed at the bottom of list
How do you add the new item to the list? Are you requerying your database and repopulating the list or simply just using AddItem.
If you are using the AddItem method you can specify its location within the list.
List1.AddItem "John", 0 - will place the item at the top of the list.
List1.AddItem "John", 5 - will insert the item at row # 5
-
Dec 27th, 2005, 03:40 PM
#14
Thread Starter
Addicted Member
Re: Listing in list box
I add with a cmdadd button that just adds to the db
dbadd = true
then when I save it repopulates, But I think that if I want it to always populate from least number to largest that I will do this in the list function I have set up but I couldn't find the right way to do this yet?
list by Id least to greatest, something along those lines not sure but am still lookin?
thanks
-
Dec 27th, 2005, 04:23 PM
#15
Thread Starter
Addicted Member
Re: Listing in list box
Ok well I searched everywere and it looks like listing these in alphabetical order seems the best way to go. And also I guess this really is not of much importance to my app since I search by ID anyway so Ill mark this as resolved and just sort by alphabetical order for two reasons one it is very easy to do it this way and two it seems the most proffessional way to do this as well listing first and last name in list box alphabeticaly in itself would make it easier to find them since they would be sorted. Not sure why I even wanted to list by IDno in the first place.
-
Dec 28th, 2005, 12:44 PM
#16
Re: [RESOLVED] Listing in list box
Did you try doing your sort use an SQL ORDER BY prior to loading the listbox?
-
Dec 29th, 2005, 01:01 AM
#17
Junior Member
Re: [RESOLVED] Listing in list box
will u show your code here?
Virendrasinh Narendrasinh Mahida
----------------------------------
There is Never a WRONG time to do the RIGHT Thing 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|