473,796 Members | 2,798 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I can't sort my combo box. Please Help!

raj
When I try to sort my combo box I get the following error.

"Cannot sort a ComboBox that has a DataSource set. Sort the data using the
underlying data model."

--------------------------------THe code is given below.
String strSQL;

strSQL = "SELECT .......... WHERE C.Client = '" +
this.cboClient. SelectedValue + "' ";
userTable = manager.GetData Table(strSQL,"u serList");

cmbUserList.Dat aSource = userTable;
cmbUserList.Dis playMember = "FollowUpPerson ";
cmbUserList.Val ueMember = "FollowUpPerson ";

cmbUserList.Sel ectedIndex = -1;
cmbUserList.Sor ted = true;
------------------------------------------------
I do really appreciate any ideas or sugessions.

Thanks

raj
Jul 21 '05 #1
6 5810
Raj,
The combobox will not fill if it has 'sorted' preselected in the design
process.

--------------------
Thread-Topic: I can't sort my combo box. Please Help!
thread-index: AcS/xvw8xLfcJGSzQJK vGzE1Rk/XNQ==
X-WBNR-Posting-Host: 203.28.214.209
From: =?Utf-8?B?cmFq?= <ra*@discussion s.microsoft.com >
Subject: I can't sort my combo box. Please Help!
Date: Sun, 31 Oct 2004 19:58:02 -0800
Lines: 24
Message-ID: <0F************ *************** *******@microso ft.com>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.publi c.dotnet.genera l
NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.1.29
Path: cpmsftngxa10.ph x.gbl!TK2MSFTNG XA03.phx.gbl
Xref: cpmsftngxa10.ph x.gbl microsoft.publi c.dotnet.genera l:150745
X-Tomcat-NG: microsoft.publi c.dotnet.genera l

When I try to sort my combo box I get the following error.

"Cannot sort a ComboBox that has a DataSource set. Sort the data using the
underlying data model."

--------------------------------THe code is given below.
String strSQL;

strSQL = "SELECT .......... WHERE C.Client = '" +
this.cboClient .SelectedValue + "' ";
userTable = manager.GetData Table(strSQL,"u serList");

cmbUserList.Da taSource = userTable;
cmbUserList.Di splayMember = "FollowUpPerson ";
cmbUserList.Va lueMember = "FollowUpPerson ";

cmbUserList.Se lectedIndex = -1;
cmbUserList.So rted = true;
------------------------------------------------
I do really appreciate any ideas or sugessions.

Thanks

raj


{\rtf1\ansi\ans icpg1252\deff0\ deflang1033{\fo nttbl{\f0\fnil\ fprq2\fcharset0
MS Sans Serif;}{\f1\fsw iss\fcharset0 Arial;}}
{\*\generator Msftedit 5.41.21.2500;}\ viewkind4\uc1\p ard\f0\fs20 Cheers,\par
\par
johnKn [MS-SDK]\par
\par
\par
\par
-Please do not send email directly to this alias. This alias is for \par
newsgroup purposes only\par
\par
-This posting is provided "AS IS" with no warranties, and confers no
rights.\par
\par
-To provide additional feedback about your community experience please send
\par
e-mail to: sd*****@microso ft.com\par
\f1\par
}

Jul 21 '05 #2
raj
Hi John Kn
No. the combobox field is not preselected. It is setted to 'FALSE'.
U'r correct it will not get populated if I selected to 'TRUE'.
But my combo box is get populated (As it SORT's seleted to 'FALSE') but I
can't sort at the moment. Do u have any suggestions? I'm trying to explicitly
code as 'cmbUserList.So rted = true;' This will crashes my aplication with
error message.

Thanks
raj

"John Kn [MS]" wrote:
Raj,
The combobox will not fill if it has 'sorted' preselected in the design
process.

--------------------
Thread-Topic: I can't sort my combo box. Please Help!
thread-index: AcS/xvw8xLfcJGSzQJK vGzE1Rk/XNQ==
X-WBNR-Posting-Host: 203.28.214.209
From: =?Utf-8?B?cmFq?= <ra*@discussion s.microsoft.com >
Subject: I can't sort my combo box. Please Help!
Date: Sun, 31 Oct 2004 19:58:02 -0800
Lines: 24
Message-ID: <0F************ *************** *******@microso ft.com>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.publi c.dotnet.genera l
NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.1.29
Path: cpmsftngxa10.ph x.gbl!TK2MSFTNG XA03.phx.gbl
Xref: cpmsftngxa10.ph x.gbl microsoft.publi c.dotnet.genera l:150745
X-Tomcat-NG: microsoft.publi c.dotnet.genera l

When I try to sort my combo box I get the following error.

"Cannot sort a ComboBox that has a DataSource set. Sort the data using the
underlying data model."

--------------------------------THe code is given below.
String strSQL;

strSQL = "SELECT .......... WHERE C.Client = '" +
this.cboClient .SelectedValue + "' ";
userTable = manager.GetData Table(strSQL,"u serList");

cmbUserList.Da taSource = userTable;
cmbUserList.Di splayMember = "FollowUpPerson ";
cmbUserList.Va lueMember = "FollowUpPerson ";

cmbUserList.Se lectedIndex = -1;
cmbUserList.So rted = true;
------------------------------------------------
I do really appreciate any ideas or sugessions.

Thanks

raj


{\rtf1\ansi\ans icpg1252\deff0\ deflang1033{\fo nttbl{\f0\fnil\ fprq2\fcharset0
MS Sans Serif;}{\f1\fsw iss\fcharset0 Arial;}}
{\*\generator Msftedit 5.41.21.2500;}\ viewkind4\uc1\p ard\f0\fs20 Cheers,\par
\par
johnKn [MS-SDK]\par
\par
\par
\par
-Please do not send email directly to this alias. This alias is for \par
newsgroup purposes only\par
\par
-This posting is provided "AS IS" with no warranties, and confers no
rights.\par
\par
-To provide additional feedback about your community experience please send
\par
e-mail to: sd*****@microso ft.com\par
\f1\par
}

Jul 21 '05 #3
Raj,

As the message tells, do you have when you use the datasource have to use a
sorted datasource, what is very easy to do.

Typed here so watch typos

DataView dv = new DataView(userTa ble);
dv.Sort = "FollowUpPerson ";
cmbUserList.Dat aSource = dv;
>cmbUserList.Di splayMember = "FollowUpPerson ";
>cmbUserList.Va lueMember = "FollowUpPerson ";


I hope this helps?

Cor
Jul 21 '05 #4
raj wrote:
When I try to sort my combo box I get the following error.

"Cannot sort a ComboBox that has a DataSource set. Sort the data using the
underlying data model."

--------------------------------THe code is given below.
String strSQL;

strSQL = "SELECT .......... WHERE C.Client = '" +
this.cboClient. SelectedValue + "' ";
userTable = manager.GetData Table(strSQL,"u serList");

cmbUserList.Dat aSource = userTable;
cmbUserList.Dis playMember = "FollowUpPerson ";
cmbUserList.Val ueMember = "FollowUpPerson ";

cmbUserList.Sel ectedIndex = -1;
cmbUserList.Sor ted = true;
------------------------------------------------
I do really appreciate any ideas or sugessions.

Thanks

raj


Why not simply sort in the SQL query (order by FolowUpPerson)?

Rinze
Jul 21 '05 #5

You can also just sort on the .DefaultView property of the datatable,
instead of creating a new dataview object.

"Cor Ligthert" <no************ @planet.nl> wrote in message
news:e%******** **********@TK2M SFTNGP12.phx.gb l...
Raj,

As the message tells, do you have when you use the datasource have to use
a sorted datasource, what is very easy to do.

Typed here so watch typos

DataView dv = new DataView(userTa ble);
dv.Sort = "FollowUpPerson ";
cmbUserList.Dat aSource = dv;
>cmbUserList.Di splayMember = "FollowUpPerson ";
>cmbUserList.Va lueMember = "FollowUpPerson ";


I hope this helps?

Cor

Jul 21 '05 #6
raj
Hi
It works now.
I would like to thanks John, Cor Ligthert. Patrick and C-Serveces Holland,
for assisting me to solve this problem. Once again, many thanks.

Cheers

raj
"C-Services Holland b.v." wrote:
raj wrote:
When I try to sort my combo box I get the following error.

"Cannot sort a ComboBox that has a DataSource set. Sort the data using the
underlying data model."

--------------------------------THe code is given below.
String strSQL;

strSQL = "SELECT .......... WHERE C.Client = '" +
this.cboClient. SelectedValue + "' ";
userTable = manager.GetData Table(strSQL,"u serList");

cmbUserList.Dat aSource = userTable;
cmbUserList.Dis playMember = "FollowUpPerson ";
cmbUserList.Val ueMember = "FollowUpPerson ";

cmbUserList.Sel ectedIndex = -1;
cmbUserList.Sor ted = true;
------------------------------------------------
I do really appreciate any ideas or sugessions.

Thanks

raj


Why not simply sort in the SQL query (order by FolowUpPerson)?

Rinze

Jul 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
9148
by: Bayou BoB | last post by:
Hi! Currently my combo box contents are not in alphabetical order, and I'm wondering if there is a way to make the contents appear in alphabetical order when you open the combo box. How would you do this? Many thanks! Kevin
2
22085
by: Aravind | last post by:
Hi folks. I'm doing a library system which contains a table caled "Member", which in turn contains an ID key and the member's name. I have a combo box which allows the user to pick a name from the combo box to view that person's history of borowing books, etc. However, the combo box is not sorted by name (its sorted by the ID key, which I kept hidden). So how do I sort the combo box by name? Thank you.
6
368
by: raj | last post by:
When I try to sort my combo box I get the following error. "Cannot sort a ComboBox that has a DataSource set. Sort the data using the underlying data model." --------------------------------THe code is given below. String strSQL; strSQL = "SELECT .......... WHERE C.Client = '" + this.cboClient.SelectedValue + "' ";
7
1852
by: Ausclad | last post by:
Ok, ill try again..... It seems fairly simple. I have two combo boxes in a datagrid. The datagrid is bound to a a table in a dataset. The two combo boxes are bound to a single data table in a different dataset. One combo box is displaying the Employees payroll ID. The other is
6
1345
by: shror | last post by:
I need your help please in an aspx webpage. I have 2 combo boxes in the page The first combo load and when i select item from it then the other combo should be loaded then and this cenario work fine in Fire Fox but on Internet Explorer when i select the item from the first combo it doesn't load the second combo but it gives the yellow error mark in the statusbar <error in page> and the says error:
3
1558
by: Strasser | last post by:
In a nested subform in datasheet view, an interviewer of homeless people picks a descriptive CATEGORY from 20 descriptive categories. The 20 categories are displayed via a combo box. (Categories are things like "addiction", "criminal", "dangerous?" etc. Total number of categories = 20). For EACH of the 20 categories there are 5 statuses, from "bad" (1=worst) to "good" (5=best). (Therefore, there are really 100 choices: 20 categories...
2
1455
by: jafarsibtain | last post by:
hi.. I am creating a form where there are two combo Boxes (drop Down) > Program_Combo_box > Course_Code_Combo in the Program Combo Box there are five items in the list > 1. BIT 2.BCA 3. MCA
2
2108
by: necron99 | last post by:
import RuntimeEnvironment as renv import os, sys import win32com.client import getpass OMI = win32com.client.Dispatch("MOVEitAPI.clientObj") OMI.Host = system
12
2157
by: Lnwolf | last post by:
Hello, I am having an issue with my synchronized combo boxes and don't know how to fix it. I have created two boxes and have made the synchronization work (the user clicks on the first box and makes a choice and the second only shows items which are related to the first box's choice). My problem is that the user can not choose from any of the choices in the second combo... whatever is clicked on the very first item is the only thing that...
0
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9535
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10244
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10201
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7558
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5454
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2931
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.