using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace AyaNovaQBI { public partial class SetQBImportInventoryAccounts : Form { public SetQBImportInventoryAccounts() { InitializeComponent(); } private void SetQBImportInventoryAccounts_Load(object sender, EventArgs e) { //Fill combo's and select defaults cbAsset.BindingContext = new BindingContext();//Ensure unique binding context so multiple combo boxes bound to same datasource can be selected independantly cbAsset.DisplayMember = "FullName"; cbAsset.ValueMember = "ID"; cbAsset.DataSource = util.QBAccounts; if (!string.IsNullOrEmpty(util.QDat.QBInventoryAssetAccountRef)) cbAsset.SelectedValue = util.QDat.QBInventoryAssetAccountRef; cbCogs.BindingContext = new BindingContext(); cbCogs.DisplayMember = "FullName"; cbCogs.ValueMember = "ID"; cbCogs.DataSource = util.QBAccounts; if (!string.IsNullOrEmpty(util.QDat.QBInventoryCOGSAccountRef)) cbCogs.SelectedValue = util.QDat.QBInventoryCOGSAccountRef; cbIncome.BindingContext = new BindingContext(); cbIncome.DisplayMember = "FullName"; cbIncome.ValueMember = "ID"; cbIncome.DataSource = util.QBAccounts; if (!string.IsNullOrEmpty(util.QDat.QBInventoryIncomeAccountReference)) cbIncome.SelectedValue = util.QDat.QBInventoryIncomeAccountReference; } } }