473,386 Members | 1,785 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,386 software developers and data experts.

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.GetDataTable(strSQL,"userList");

cmbUserList.DataSource = userTable;
cmbUserList.DisplayMember = "FollowUpPerson";
cmbUserList.ValueMember = "FollowUpPerson";

cmbUserList.SelectedIndex = -1;
cmbUserList.Sorted = true;
------------------------------------------------
I do really appreciate any ideas or sugessions.

Thanks

raj
Jul 21 '05 #1
6 5770
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/xvw8xLfcJGSzQJKvGzE1Rk/XNQ==
X-WBNR-Posting-Host: 203.28.214.209
From: =?Utf-8?B?cmFq?= <ra*@discussions.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**********************************@microsoft.co m>
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.public.dotnet.general
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.general:150745
X-Tomcat-NG: microsoft.public.dotnet.general

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.GetDataTable(strSQL,"userList");

cmbUserList.DataSource = userTable;
cmbUserList.DisplayMember = "FollowUpPerson";
cmbUserList.ValueMember = "FollowUpPerson";

cmbUserList.SelectedIndex = -1;
cmbUserList.Sorted = true;
------------------------------------------------
I do really appreciate any ideas or sugessions.

Thanks

raj


{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl {\f0\fnil\fprq2\fcharset0
MS Sans Serif;}{\f1\fswiss\fcharset0 Arial;}}
{\*\generator Msftedit 5.41.21.2500;}\viewkind4\uc1\pard\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*****@microsoft.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.Sorted = 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/xvw8xLfcJGSzQJKvGzE1Rk/XNQ==
X-WBNR-Posting-Host: 203.28.214.209
From: =?Utf-8?B?cmFq?= <ra*@discussions.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**********************************@microsoft.co m>
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.public.dotnet.general
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.general:150745
X-Tomcat-NG: microsoft.public.dotnet.general

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.GetDataTable(strSQL,"userList");

cmbUserList.DataSource = userTable;
cmbUserList.DisplayMember = "FollowUpPerson";
cmbUserList.ValueMember = "FollowUpPerson";

cmbUserList.SelectedIndex = -1;
cmbUserList.Sorted = true;
------------------------------------------------
I do really appreciate any ideas or sugessions.

Thanks

raj


{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl {\f0\fnil\fprq2\fcharset0
MS Sans Serif;}{\f1\fswiss\fcharset0 Arial;}}
{\*\generator Msftedit 5.41.21.2500;}\viewkind4\uc1\pard\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*****@microsoft.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(userTable);
dv.Sort = "FollowUpPerson";
cmbUserList.DataSource = dv;
>cmbUserList.DisplayMember = "FollowUpPerson";
>cmbUserList.ValueMember = "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.GetDataTable(strSQL,"userList");

cmbUserList.DataSource = userTable;
cmbUserList.DisplayMember = "FollowUpPerson";
cmbUserList.ValueMember = "FollowUpPerson";

cmbUserList.SelectedIndex = -1;
cmbUserList.Sorted = 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%******************@TK2MSFTNGP12.phx.gbl...
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(userTable);
dv.Sort = "FollowUpPerson";
cmbUserList.DataSource = dv;
>cmbUserList.DisplayMember = "FollowUpPerson";
>cmbUserList.ValueMember = "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.GetDataTable(strSQL,"userList");

cmbUserList.DataSource = userTable;
cmbUserList.DisplayMember = "FollowUpPerson";
cmbUserList.ValueMember = "FollowUpPerson";

cmbUserList.SelectedIndex = -1;
cmbUserList.Sorted = 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
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...
2
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...
6
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." ...
7
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...
6
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...
3
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...
2
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....
2
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
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
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...

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.