public void Add(string Text, string Field) { DataColumnHeader col = new DataColumnHeader(); col.Text = Text; col.Field = Field; List.Add((DataColumnHeader)col); }
public void Add(string Field, int Width) { DataColumnHeader col = new DataColumnHeader(); col.Text = Field; col.Field = Field; col.Width = Width; List.Add((DataColumnHeader)col); }
private void DoAutoDiscovery(DataView ds) { int Field; DataColumnHeader Col; for (Field = 0; Field < ds.Table.Columns.Count; Field++) { if (ds.Table.Columns[Field].ColumnMapping != MappingType.Hidden) { Col = new DataColumnHeader(); Col.Text = ds.Table.Columns[Field].Caption; Col.Field = ds.Table.Columns[Field].ColumnName; this.mColumns.Add(Col); } } }
private void DoAutoDiscovery(IList ds) { if (ds.Count > 0) { object obj = ds[0]; if (obj is ValueType && obj.GetType().IsPrimitive) { DataColumnHeader Col = new DataColumnHeader(); Col.Text = "Value"; this.mColumns.Add(Col); } else { if (obj is string) { DataColumnHeader Col = new DataColumnHeader(); Col.Text = "String"; this.mColumns.Add(Col); } else { Type SourceType = obj.GetType(); PropertyInfo[] props = SourceType.GetProperties(); if (props.Length >= 0) { for (int column = 0; column < props.Length; column++) { this.mColumns.Add(props[column].Name); } } FieldInfo[] fields = SourceType.GetFields(); if (fields.Length >= 0) { for (int column = 0; column < fields.Length; column++) { this.mColumns.Add(fields[column].Name); } } } } } }
public void Add(DataColumnHeader Item) { List.Add((DataColumnHeader)Item); }