次のコードがあります。
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
をパブリックまたは何かとして宣言する必要がありますか? もしそうなら、これはどのように行われますか?