private void button1_Click(object sender, EventArgs e) { classx duration = new classx(); //Note that you should not use Text here, but selectedText //Note that now your classx takes input from comboBox2.SelectedText MessageBox.Show("From " + comboBox1.SelectedText + " to " + comboBox2.SelectedText + " it takes around " + duration.Times(comboBox2.SelectedText)); }
private void button1_Click(object sender, EventArgs e) { classx duration = new classx(); MessageBox.Show("From " + comboBox1.Text + " to " + comboBox2.Text + " it takes around " + duration.Times()); }