private void button3_Click(object sender, EventArgs e) { // Next button if (currentPage == 0) { panel4.BringToFront(); currentPage = 1; button3.Enabled = false; button2.Enabled = true; if (!diameterValuesInserted) { flowLayoutPanel1.Controls.Clear(); // Initialize diameter options for (int i = 0; i < diameterNumber; i++) { DiameterOption dia = new DiameterOption(); dia.Name = "Stab " + (i + 1) + " Ø :"; dia.Index = i; dia.Anchor = AnchorStyles.Left; dia.Anchor = AnchorStyles.Right; flowLayoutPanel1.Controls.Add(dia); } diameterValuesInserted = true; } } else if (currentPage == 1) { } }
private void button12_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Title = "Choose csv1 file"; ofd.Filter = "CSV |*.csv"; ofd.InitialDirectory = Settings.Default.ProjectPath + "\\CSV"; if (ofd.ShowDialog() == DialogResult.OK) // if user didn't cancel { csv1Path = ofd.FileName; // full File Path //file = Path.GetFileName(path); label26.Text = csv1Path; Settings.Default.csv1Path = csv1Path; Settings.Default.Save(); // Renew diameterNumber diameterNumber = 0; using (var reader = new StreamReader(csv1Path)) { while (!reader.EndOfStream) { if (!reader.ReadLine().Equals("")) { var line = reader.ReadLine(); var values = line.Split(';'); if (int.Parse(values[2]) > diameterNumber) // Get highest value of diameter { diameterNumber = int.Parse(values[2]); } } } } diameterValuesInserted = false; // Renew Diameter options if (!diameterValuesInserted) { flowLayoutPanel1.Controls.Clear(); // Initialize diameter options for (int i = 0; i <= diameterNumber; i++) { DiameterOption dia = new DiameterOption(); dia.Name = "Stab " + (i + 1) + " Ø :"; dia.Index = i; flowLayoutPanel1.Controls.Add(dia); } diameterValuesInserted = true; } button11.Enabled = true; } }