checkBox SameAsPrevious で HomeAddressUC から PermanentAddressUC にすべてのデータを転送したい
各 UserControl は同じ Type(AddressUserControl) を持ちます
HomeAddressUCを埋めるDataSourceのコードはこんな感じ
private void SetTabPageDetails(string tabPageName, CustomerDetails customerDetailsCache)
{
customerDetailsCache = // calling stored procedure
PermanentAddressUC.SetDetails(customerDetailsCache.Addresses[0]);
}
そのDataSourceの範囲は、SetTabPageDetails()
私が実装しようとしていたメソッドのみのロジックであり、チェックボックスの変更されたイベントにあります
if (chkSameAsPervious.Checked)
{
foreach (var addressCtl in from Control ctl in this.ADDRESS_TAB.Controls select ctl as BankSys24.UI.UserControls.AddressUserControl)
{
if (addressCtl.GroupBoxText == "Mailing Address")
{
// want to do something here
}
}
}
関連するリンクをたどってみます
通信に 2 つのユーザー コントロール (winform) が必要な場合のベスト プラクティス
サード コモン ユーザー コントロール コンテナまたはインターフェイスを使用するように指示されています
それを行う最適化された方法は何ですか?