public void SetFilePath(string filePath) { this.filePathLabel.Text = filePath; this.reader = new CSVReader(filePath); this.stringData = this.reader.ReadDataToString(); this.variableCount = this.reader.ColumnCount; ValidatedNameTextBoxCell cellTemplate = new ValidatedNameTextBoxCell(); this.nameColumn.CellTemplate = cellTemplate; this.variableNameGrid.RowCount = this.variableCount; for (int i = 0; i < this.variableCount; i++) { this.variableNameGrid[0, i].Value = true; this.variableNameGrid[1, i].Value = (i + 1).ToString(); this.variableNameGrid[2, i].Value = "variable" + (i + 1).ToString(); } for (int i = 0; i < reader.RowCount; i++) { for (int j = 0; j < reader.ColumnCount - 1; j++) { this.previewTextBox.AppendText(this.stringData[i][j] + "\t"); } this.previewTextBox.AppendText(this.stringData[i][reader.ColumnCount - 1] + "\n"); } this.previewTextBox.Text = this.previewTextBox.Text; this.selectedVariables = new SeriesVariables(); }
public void SetFilePath(string filePath) { this.filePathLabel.Text = filePath; excel = new ExcelReader(filePath); this.excelData = excel.ReadData(); cboSheet.Items.Clear(); cboSheet.DisplayMember = "TableName"; foreach (DataTable dt in this.excelData.Tables) { cboSheet.Items.Add(dt); } if (cboSheet.Items.Count == 0) { return; } cboSheet.SelectedIndex = 0; ValidatedNameTextBoxCell cellTemplate = new ValidatedNameTextBoxCell(); this.nameColumn.CellTemplate = cellTemplate; if (this.excelData.Tables[cboSheet.SelectedIndex].Rows.Count > 0) { this.variableNameGrid.RowCount = this.excelData.Tables[0].Columns.Count; for (int i = 0; i < this.excelData.Tables[0].Columns.Count; i++) { this.variableNameGrid[0, i].Value = false; this.variableNameGrid[1, i].Value = (i + 1).ToString(); this.variableNameGrid[2, i].Value = "variable" + (i + 1).ToString(); } } this.selectedVariables = new SeriesVariables(); }
public void SetFilePath(string filePath) { this.filePathLabel.Text = filePath; excel = new ExcelReader(filePath); this.excelData = excel.ReadData(); cboSheet.Items.Clear(); cboSheet.DisplayMember = "TableName"; foreach (DataTable dt in this.excelData.Tables) cboSheet.Items.Add(dt); if (cboSheet.Items.Count == 0) return; cboSheet.SelectedIndex = 0; ValidatedNameTextBoxCell cellTemplate = new ValidatedNameTextBoxCell(); this.nameColumn.CellTemplate = cellTemplate; if (this.excelData.Tables[cboSheet.SelectedIndex].Rows.Count > 0) { this.variableNameGrid.RowCount = this.excelData.Tables[0].Columns.Count; for (int i = 0; i < this.excelData.Tables[0].Columns.Count; i++) { this.variableNameGrid[0, i].Value = false; this.variableNameGrid[1, i].Value = (i + 1).ToString(); this.variableNameGrid[2, i].Value = "variable" + (i + 1).ToString(); } } this.selectedVariables = new SeriesVariables(); }