如何从列表框中获取值?

How to get the value from listbox?

我正在编写一个 C# windows 窗体应用程序。我有一个代码部分,如:

listBox1.Items.Add(comboBox1.SelectedItem + "\t" + "\t"  + textBox5.Text + "\t" + textBox4.Text + "\t" + textBox6.Text + "\n");

这里我想取textBox6.Text的值,我想把它赋给一个double变量。

我该怎么做?

只需使用 tryParse 方法

float val = 0;
float.TryParse(textBox6.Text, out val);