示例#1
0
        protected TableDataRow GetEntireRow(int rowIndex, bool skipFirstColumn = false)
        {
            /* Return a row data, with each column being an element in the returned array. Return null,
             * if there is a problem with what is being parsed. The list of problems that can arise are:
             *     - no data found in a cell. */
            if (!ValidateRow(rowIndex, skipFirstColumn))
            {
                return(null);
            }

            TableDataRow dr = new TableDataRow();

            for (int i = (skipFirstColumn) ? 1 : 0; i < m_tableView.Rows[rowIndex].Cells.Count; i++)
            {
                // start at 1 to skip the first column as it is the label column, so any data is not relevant
                if (CanParseToInt(m_tableView.Rows[rowIndex].Cells[i].Value.ToString()))
                {
                    // add as int if it can
                    dr.Add(DataItem.Parse(Int32.Parse(m_tableView.Rows[rowIndex].Cells[i].Value.ToString())));
                }
                else
                {
                    // if all other data types fail, add as string
                    dr.Add(DataItem.Parse(m_tableView.Rows[rowIndex].Cells[i].Value.ToString()));
                }
            }

            return(dr);
        }
示例#2
0
        protected TableDataRow GetEntireColumn(int colIndex)
        {
            /* Return the data of from an entire column. Return null if there is a problem with what is being parsed.
             * The lsit of problems that can arise are:
             *  - no data found in a cell. */
            if (!ValidateColumn(colIndex))
            {
                return(null);
            }

            TableDataRow data = new TableDataRow();

            for (int i = 0; i < this.RowCount; i++)
            {
                data.Add(DataItem.Parse(m_tableView.Rows[i].Cells[colIndex]));
            }

            return(data);
        }