private void UpdateFields() { lbxFields.SuspendLayout(); lbxFields.Items.Clear(); if (_attributeSource != null) { DataColumn[] columns = _attributeSource.GetColumns(); foreach (DataColumn dc in columns) { lbxFields.Items.Add(dc.ColumnName); } } else if (_table != null) { foreach (DataColumn dc in _table.Columns) { lbxFields.Items.Add(dc.ColumnName); } } lbxFields.ResumeLayout(); }
/// <summary> /// Replaces the expression fields by the columns of the current _attributeSource or _table. /// </summary> private void UpdateFields() { bool hasFid = false; _exp.ClearFields(); dgvFields.SuspendLayout(); dgvFields.Rows.Clear(); if (_attributeSource != null) { DataColumn[] columns = _attributeSource.GetColumns(); foreach (DataColumn dc in columns) { _exp.AddField(dc); dgvFields.Rows.Add(dc.ColumnName, dc.DataType.ToString().Replace("System.", string.Empty)); if (dc.ColumnName.ToLower() == "fid") { hasFid = true; } } } else if (_table != null) { foreach (DataColumn dc in _table.Columns) { _exp.AddField(dc); dgvFields.Rows.Add(dc.ColumnName, dc.DataType.ToString().Replace("System.", string.Empty)); if (dc.ColumnName.ToLower() == "fid") { hasFid = true; } } } if (!hasFid) { dgvFields.Rows.Add("FID", typeof(int).ToString().Replace("System.", string.Empty)); } dgvFields.ResumeLayout(); }