public CalibLookupDRConfig(CalibLookupDR dataReference, bool bReadOnly) { InitializeComponent(); fDataReference = dataReference; if (dataReference.Attribute != null) { AFElement elem = dataReference.Attribute.Element as AFElement; if (elem != null) { ProcessAttributes(elem.Attributes, ""); } } else if (dataReference.Template != null) { AFElementTemplate templ = dataReference.Template.ElementTemplate as AFElementTemplate; if (templ != null) { ProcessTemplate(templ, ""); } } txtAttribute.Sorted = true; fTables = Database.Tables; PopulateTableCombo(fTables); if (bReadOnly) { txtAttribute.Enabled = false; btnOK.Visible = false; btnOK.Enabled = false; btnCancel.Left = (btnOK.Left + btnCancel.Left) / 2; btnCancel.Text = "Close"; base.AcceptButton = btnCancel; } if (!string.IsNullOrEmpty(dataReference.AttributeName)) { txtAttribute.Text = dataReference.AttributeName; } if (!string.IsNullOrEmpty(dataReference.TableName)) { cmbTable.Text = dataReference.TableName; } if (!string.IsNullOrEmpty(dataReference.KeyField)) { cmbKeyField.Text = dataReference.KeyField; } if (!string.IsNullOrEmpty(dataReference.ValueField)) { cmbValueField.Text = dataReference.ValueField; } }
private void PopulateTableCombo(AFTables tablesToPopulate) { cmbTable.BeginUpdate(); cmbTable.Items.Add(string.Empty); foreach (AFTable current in tablesToPopulate) { cmbTable.Items.Add(current.Name); } cmbTable.EndUpdate(); }