I have the following code:
public Form1()
{
InitializeComponent();
string strRadio = Utils.ReadFile(strTemp + @"
stations.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)]);
}
Now the error is The name 'aRadio' does not exist in the current context
. Which comes from MessageBox.Show(aRadio[(index+1)]);
. Do I need to declare the aRadio
as public or something? If so, how would this be done?