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

Please Help with the combox DisplayValue property

raj
Please Help with the combox DisplayValue property

private void cboClient_SelectionChangeCommitted(object sender,
System.EventArgs e)
{
String strSQL;
strSQL = "SELECT F.FollowUpPerson FROM tblFollowUpPerson F INNER JOIN
tblFollowUpPersonClient C ON F.FollowUpPersonID = C.FollowUpPersonID WHERE
C.ClientKey = '" + this.cboClient.SelectedValue + "' ";
ds = mg.GetDataSet(strSQL,"userList"); //Def is described at the end

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

}

//Def
public DataSet GetDataSet(string sqlQuery, string name)
{
SqlConnection conn = null;

if ( m_connInfo == null )
return null;

try
{
if ( persistTrans == null )
conn = new SqlConnection(m_connInfo.DBConnString);
else
conn = persistTrans.Connection;

m_dataAdapter = new SqlDataAdapter(sqlQuery, conn);
SqlCommandBuilder cmdBuilder = new SqlCommandBuilder(m_dataAdapter);
DataSet dataSet = new DataSet(name);
m_dataAdapter.SelectCommand.CommandTimeout = m_connInfo.CommandTimeout;
m_dataAdapter.Fill(dataSet);

return dataSet;
}
catch(Exception e)
{
logger.Write(sqlQuery);
logger.WriteLine(e);
return null;
}
finally
{
if ( persistTrans == null && conn != null )
conn.Close();
}
}

------------------------------------------------------------------------------------------
My application get crashes in
cmbUserList.DisplayMember = "FollowUpPerson";

Could u pls telll me why?

THe error message is
"An unhandled exception of type 'System.ArgumentException' occurred in
system.windows.forms.dll
Additional information: Could not bind to the new display member."

Thanks

raj

Jul 21 '05 #1
0 1039

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

Similar topics

10
by: Eva | last post by:
Does anyone know how i can connect my combobox to my acces DB? i have tried setting the datasource to a dataset but i cannot seem to locate the item property under the DataBindings list. I ended...
4
by: Li Pang | last post by:
I can only use combox1.enabled = false to stop entering data, but it's gray out the control (not nice). Is there a way to set readonly on the control (or set the color back to white)? Thanks ...
0
by: raj | last post by:
Please Help with the combox DisplayValue property private void cboClient_SelectionChangeCommitted(object sender, System.EventArgs e) { String strSQL; strSQL = "SELECT F.FollowUpPerson FROM...
2
by: Bob | last post by:
The scenario is that of the employees table wherein there's an EmployeeId and a ReportsTo field in the same table. The combobox is one in a datagrid view that lets you select an employee from the...
2
by: Mark L. Breen | last post by:
Hello All, I have been playing with a combo box for the last day or so, attempting to get my head around the best or the recommended way to update them. I had problems setting the .Text and...
1
by: GS | last post by:
I got a combobox box that I load at load time. the Item and vales ended up in reverse order of each other, what went wrong? the database table has the following row code value ebay ...
1
by: neo1ra | last post by:
Hi, I'm doing a search combox to pop up and specific record. Everything is working fine until I make a change to the record that I'm working on and try to move to other record. A error message...
2
by: summiyashaheen | last post by:
how to read the valuemember of the combox whose data source is a detaset. i have assigned the properties of displaymember and valuemember . display member cis visible but i cant get the value member...
2
by: haringmunti | last post by:
hi, im new to vb.net and i think it is very interesting. im taking a course on it right now and sadly, the one giving the lecture is not doing a good job. anyway, my question is how do i make a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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.