private void GenExperiment(Experiment experiment) { var fields = new FieldText[experiment.NbFactor]; for (int i = 0; i < experiment.NbFactor; i++) { fields[i] = new FieldText("F" + (i + 1).ToString() + " values (" + experiment.NbLevels[i] + ")", "List of values seperated by a semicolon", ""); fields[i].MaxValues = experiment.NbLevels[i]; } new InputBox(_excelapp, "Generate experiment", fields).Show(delegate { var valuesList = new List<string[]>(experiment.NbFactor); for (int i = 0; i < fields.Length; i++) { if (string.IsNullOrEmpty(fields[i].Value)) valuesList.Add(null); else { valuesList.Add(fields[i].Value.Split(';')); } } CellsOperator.AddDataToRange(_range, experiment.GetArray(valuesList)); }); }