473,473 Members | 1,822 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

problems sorting a combobox

11 New Member
I have a combo box that I can not get to sort correctly. I fill the combobox with a customer id and name ( combined) have set the combobox.sorted = true
I saw one Idea here about turning the .sorted of the back on, but then the combobox list showed the same customerID all the way down the list.

Thanks for any help,
David

the data comes from a dataset and put into the combobox with the following code

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub FillList()
  3.         ' use this sub to fill or refill the cusomer id list  
  4.         ' for the following events: add, update, delete customers
  5.         Me.ComboBox_CustomerID.Items.Clear()
  6.  
  7.         Dim p As id_storename = New id_storename()
  8.         Dim findinc As Integer
  9.         findinc = 0
  10.  
  11.         Do While findinc <> MainForm.MaxRows
  12.             p.tmp_ID = ds.Tables("AddressBook").Rows(findinc).Item("CustID")
  13.             p.tmp_StoreName = ds.Tables("AddressBook").Rows(findinc).Item("CompanyName")
  14.             Me.ComboBox_CustomerID.Items.Add(p)
  15.             findinc = findinc + 1
  16.         Loop
  17.         ComboBox_CustomerID.Focus()
  18.     End Sub
  19.  
Jan 14 '07 #1
3 1318
kenobewan
4,871 Recognized Expert Specialist
One way to do this is to create a dataview and use the dataview.sort method before binding it to the combobox...

Hope that this helps.
Jan 14 '07 #2
DeWittds
11 New Member
I guess that would do it, but shouldn't the combobox.sorted work and if so is there a known problem with.

Thanks



One way to do this is to create a dataview and use the dataview.sort method before binding it to the combobox...

Hope that this helps.
Jan 14 '07 #3
kenobewan
4,871 Recognized Expert Specialist
Apparently, if you have combobox.sorted = true you cannot set DataSource. Remove it. This may mean that your existing code will work. I suggested the dataview as this is the way that I normally do it.

Hope that this helps.
Jan 14 '07 #4

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

Similar topics

3
by: Paul Fairless | last post by:
Customers table - contains Columns: CustID, Surname, Forename, TtlID Titles table - contains Columns: TtlID, Title TtlID is a Foreign Key in the Customers table. I have a Form frmCustomers...
12
by: Eva | last post by:
Hi, I try to implement quick sort. I sort vectors by their first value. 10 2 3 4 9 3 5 6 10 4 5 6 must be 9 3 5 6 10 2 3 4 10 4 5 6 The prog works great on maybe 500 vectors, but I have an...
3
by: Bill C. | last post by:
Hello, I know this has been discussed a lot already because I've been searching around for information the last few weeks. I'm trying to implement a DataGridComboBoxColumn class. I've found...
10
by: BBFrost | last post by:
We just recently moved one of our major c# apps from VS Net 2002 to VS Net 2003. At first things were looking ok, now problems are starting to appear. So far ... (1) ...
2
by: amber | last post by:
Hello I use the following code to populate a combobox Me.cbxPeerReview.DropDownStyle = ComboBoxStyle.DropDownLis With cbxPeerRevie .DataSource = dtEm .DisplayMember = "STR_NAME_F .ValueMember...
10
by: Richard | last post by:
I have created a form which sets up a dataview. The form views one record at a time using a currencymanager. This works fine. All my text boxes bind. However I have a combo box which gets its...
1
by: aquanova | last post by:
I'm working on Microsoft Access. I have a form which views the record of one table. Inside the form, there are several columns. Now I want to sort the records with using combobox. Eg. if the value of...
3
by: Jimmy | last post by:
Is there a way to sort/group a report based on the second column of a combo box, i.e. the text associated with the primary key number?
6
by: carlos123 | last post by:
I have a programming assignement that i have been working on for quite some time now. I need your guys' help. My assignement is to great a table with data in it. and it will have a combobox and 2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.