我有以下代码:
public Form1()
{
InitializeComponent();
string strRadio = Utils.ReadFile(strTemp + @"\rstations.txt");
string[] aRadio = strRadio.Split(new string[] { "#" }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < aRadio.Length; i += 2)
{
listBox.Items.Add(aRadio[i]);
}
}
private void listBox_SelectedIndexChanged(object sender, EventArgs e)
{
int index = listBox.SelectedIndex;
MessageBox.Show(aRadio[(index+1)]);
}
现在错误是The name 'aRadio' does not exist in the current context
. 其中来自MessageBox.Show(aRadio[(index+1)]);
. 我需要将其声明aRadio
为公开的还是什么?如果是这样,这将如何完成?