public void setData(oFunction functionBase, oSingleData measuredData) { this.functionBase = functionBase; this.measuredData = measuredData; if (functionBase == null) { this.Rows.Clear(); return; } this.argumentClasses = functionBase.getArgumentList(); // Cleanup this datagridview) this.Rows.Clear(); // Build the combobox selection options string[] options = Enum.GetNames(typeof(DISPLAY_TYPE)); // Fill out this datagridview based on the supplied data ARGUMENT_STRING_COLLECTION stringData = functionBase.getArgumentString(measuredData); DataGridViewRow[] newRows = new DataGridViewRow[argumentClasses.Count]; for (int i = 0; i < argumentClasses.Count; i++) { // Add this row newRows[i] = new DataGridViewRow(); // Add the name cell newRows[i].Cells[newRows[i].Cells.Add(new DataGridViewTextBoxCell())].Value = stringData.names[i]; // Add the type cell combobox DataGridViewComboBoxCell comboBox = new DataGridViewComboBoxCell(); comboBox.DisplayStyle = DataGridViewComboBoxDisplayStyle.ComboBox; comboBox.Value = Enum.GetName(typeof(DISPLAY_TYPE), argumentClasses[i].displayMethod); comboBox.Items.AddRange(options); newRows[i].Cells.Add(comboBox); // Add the value cell newRows[i].Cells[newRows[i].Cells.Add(new DataGridViewTextBoxCell())].Value = stringData.values[i]; } // Add the new rows this.Rows.AddRange(newRows); }
public void setData(oFunction functionBase, oSingleData measuredData) { this.functionBase = functionBase; this.measuredData = measuredData; if (functionBase == null) { this.Rows.Clear(); return; } this.argumentClasses = functionBase.getArgumentList(); // Cleanup this datagridview) this.Rows.Clear(); // Build the combobox selection options string[] options = Enum.GetNames(typeof(DISPLAY_TYPE)); // Fill out this datagridview based on the supplied data ARGUMENT_STRING_COLLECTION stringData = functionBase.getArgumentString(measuredData); DataGridViewRow[] newRows = new DataGridViewRow[argumentClasses.Count]; for( int i = 0; i < argumentClasses.Count; i++ ) { // Add this row newRows[i] = new DataGridViewRow(); // Add the name cell newRows[i].Cells[newRows[i].Cells.Add(new DataGridViewTextBoxCell())].Value = stringData.names[i]; // Add the type cell combobox DataGridViewComboBoxCell comboBox = new DataGridViewComboBoxCell(); comboBox.DisplayStyle = DataGridViewComboBoxDisplayStyle.ComboBox; comboBox.Value = Enum.GetName(typeof(DISPLAY_TYPE), argumentClasses[i].displayMethod); comboBox.Items.AddRange(options); newRows[i].Cells.Add(comboBox); // Add the value cell newRows[i].Cells[newRows[i].Cells.Add(new DataGridViewTextBoxCell())].Value = stringData.values[i]; } // Add the new rows this.Rows.AddRange(newRows); }