ATMLCommonLibrary.controls.awb.AWBTextCollectionList.AddColumn C# (CSharp) Method

AddColumn() public method

public AddColumn ( string columnTitle, string columnName ) : void
columnTitle string
columnName string
return void
        public void AddColumn(string columnTitle, string columnName)
        {
            DataGridViewColumn gc = new DataGridViewTextBoxColumn();
            gc.HeaderText = columnTitle;
            gc.Name = columnName;
            gc.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            gc.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
            gc.DefaultCellStyle.Alignment = DataGridViewContentAlignment.TopLeft;
            gc.Width = Width/(_columnNames.Count + 1);
            dgTextData.Columns.Add(gc);
            _columnNames.Add(columnName);
        }

Usage Example

Beispiel #1
0
        private void usage()
        {
            var textCollectionList = new AWBTextCollectionList();

            //--- Goes In Contructor ---//
            textCollectionList.AddColumn("Title 1", "col1");
            textCollectionList.AddColumn("Title 2", "col2");

            //--- Goes in DataToControls ---//
            DataGridViewRow row = textCollectionList.AddRow();

            textCollectionList.AddColumnData(row, "col1", "cell 1 data");
            textCollectionList.AddColumnData(row, "col2", "cell 2 data");
            row = textCollectionList.AddRow();
            textCollectionList.AddColumnData(row, "col1", "more cell 1 data");
            textCollectionList.AddColumnData(row, "col2", "more cell 2 data");

            //--- Goes in ControlsToData ---//
            List <List <string> > table = textCollectionList.GetTable();

            foreach (var tableRow in table)
            {
                foreach (string rowColumn in tableRow)
                {
                }
            }
        }
All Usage Examples Of ATMLCommonLibrary.controls.awb.AWBTextCollectionList::AddColumn