469,942 Members | 2,621 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,942 developers. It's quick & easy.

DataBinding Issue with ComboBox

I have a Windows Form Which Displays one record at a
time. The DataTable object which is bound to the Form
Controls only contains the record that is being
displayed. When I need to display a different record, any
changes in the current record are saved to an Access
Database, the DataTable's Row Collection is Cleared and
the New Record is read into the DataTable. (This is done
to ensure that when the User goes to view a record, they
get the most current version of that record).

The Problem I am having is that when the Windows Form
contains a ComboBox, when the form is initially loaded,
the First record is correctly displayed. However, as soon
as I move to another record, all of the controls are
blank, even when I move back to the original record. This
is not a case of the underlying DataTable not being
filled correctly, since while stepping through the code
in the debugger, I checked the DataTable and it contained
the correct information.

I have another form that using this same method to
display records, and it functions perfectly. The only
difference is that this form contains ComboBoxes, and the
Other form doesn't. When I remove the DataBinding
statements for the ComboBoxes, this form functions

Ironically, I initially stored the data in XML files, and
this form functioned correctly.

Here is the Form Constructor:
public TestcaseEntry(CurrentUser p_User,
CurrentProject p_Project, string p_CaseSelection)
// Required for Windows Form
Designer support

this.m_User = p_User;
this.m_Project = p_Project;
this.m_CaseSelection = p_CaseSelection;

this.m_TestTypes = TestTypes.GetTypes
this.m_TestTypeView = new DataView
this.m_TestTypeView.Sort = "Category";

this.m_Programs = Programs.GetProgramList ();

this.m_CaseList = Testcases.GetCaseList
this.m_RecordCount = this.m_CaseList.Count;
this.m_RecordIndex = 0;

this.m_Testcase = new Testcases ();

this.m_Testcase.SetAuthorInfo (this.m_User.ID,

// Set the Datasource property for the Items
collection and bind this Program Control to the Testcase
this.m_cboProgram.DataSource =
this.m_cboProgram.DisplayMember = "Name";
this.m_cboProgram.ValueMember = "ID";
this.m_Testcase.TestcaseList, "ProgramID");

// Set the Datasource property for the Items
collection and bind this TestTypeCategory Control to the
Testcase Record
this.m_cboTestTypeCat.DataSource =
this.m_cboTestTypeCat.DisplayMember = "Name";
this.m_cboTestTypeCat.ValueMember = "ID";
this.m_Testcase.TestcaseList, "TestTypeCategory");

// Set the Datasource property for the Items
collection and bind this TestType Control to the Testcase
this.m_cboTestType.DataSource =
this.m_cboTestType.DisplayMember = "Name";
this.m_cboTestType.ValueMember = "ID";
this.m_Testcase.TestcaseList, "TestTypeID");

// Set the DataSource Properties for the Goto
Case List
this.cboCaseList.DataSource =
this.cboCaseList.DisplayMember = "ID";
this.cboCaseList.ValueMember = "ID";

// Bind the Textboxes to the Testcase Record
this.m_Testcase.TestcaseList, "TestcaseID" );
this.m_Testcase.TestcaseList, "AuthorString" );
this.m_Testcase.TestcaseList, "ShortDescription");
this.m_Testcase.TestcaseList, "Description" );
this.m_Testcase.TestcaseList, "ExpectedResult" );
this.m_Testcase.TestcaseList, "DataProfile" );

this.m_CurrentTestcase = (CurrencyManager)


The Only solution I can think of right now is to not
perform the DataBind for the ComboBoxes, and everytime, I
get a new record, locate the appropriate entry in each of
these comboboxes, and when the value in the comboboxes is
changed by the user, to in code update the appropriate
field in the record. Is there another solution??????

Nov 15 '05 #1
0 7492

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Richard | last post: by
13 posts views Thread by Michael Maes | last post: by
1 post views Thread by Gary Shell | last post: by
reply views Thread by Kevin Hodgson | last post: by
3 posts views Thread by Dan Slaby | last post: by
5 posts views Thread by Peter M. | last post: by
5 posts views Thread by Dennis | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.