I'm having difficulty updating Windows stationery controls that use the BindingSource object. We have a CAB / MVP / SCSF client that I (actually "we", as this is a team) are developing that will interact with WCF services running on a remote server. (This is our first attempt, so we are in training mode). One of the calls (from Presenter) to the service returns a DataSet, which contains 3 DataTables called "Contract", "Credit" and "Conditions". Each table contains only one row. When a service returns a dataset, we store it in SmartPart / View in a member variable of the class by calling a function in the BindData () view and passing the dataset to the view from the presenter class;
private System.Data.DataSet _ds = null;
public void BindData(System.Data.DataSet ds)
{
string sErr = "";
try
{
_ds = ds;
}
}
DataTables Windows Forms TextBoxes, MaskedEditBoxes Infragistics UltraComboEditor. BindingSource, DataTable, VS2008.
private System.Windows.Forms.BindingSource bindsrcContract;
private System.Windows.Forms.BindingSource bindsrcLoan;
private System.Windows.Forms.BindingSource bindsrcTerms;
,
if (bindsrcContract.DataSource == null)
{
bindsrcContract.DataSource = _ds;
bindsrcContract.DataMember = "contract";
txtContract.DataBindings.Add(new Binding("Text", bindsrcContract, "contract_id", true));
txtLateFeeAmt.DataBindings.Add(new Binding("Text", bindsrcContract, "fee_code", true));
txtPrePayPenalty.DataBindings.Add(new Binding("Text", bindsrcContract, "prepay_penalty", true));
txtLateFeeDays.DataBindings.Add(new Binding("Text", bindsrcContract, "late_days", true));
}
if (bindsrcLoan.DataSource == null)
{
bindsrcLoan.DataSource = _ds;
bindsrcLoan.DataMember = "loan";
mskRecvDate.DataBindings.Add(new Binding("Text", bindsrcLoan, "receive_date", true));
cmboDocsRcvd.DataBindings.Add(new Binding("Value", bindsrcLoan, "docs", true));
}
, . , , "", WCF.
. DataSet, 3 , ( , ..) , , smartPart/View - , . , DataSet.
, , , - . BindingSource.
bindsrcContract.ResetBindings(false);
bindsrcContract.ResetBindings(true);
bindsrcContract.RaiseListChangedEvents = true;
for (int i = 0; i < bindsrcContract.Count; i++)
{
bindsrcContract.ResetItem(i);
}
DataMember.
bindsrcContract.DataMember = "Contract";
. BindingNavigator, DataTables , , . , . - , , , ?
VisualStudio 2008, # .Net 2.0, XP, W2K3.
Wes