C#C
C#2y ago
Array

Help with Arrays in my code?

https://paste.mod.gg/giovsrlllnke/0
Having a bit of an issue with my code. Working on an assignment where I have to load code in from a textfile and it's supposed to load in blocks. My teacher has detailed some header comments on the process, but I keep getting this error When I load in the file
private void mnuFileLoad_Click(object sender, EventArgs e)
        {
            //todo
            //load the file and store it into the colour array file 
            //set all the colours to be unselected
            //select a file
            OpenFileDialog oFD = new OpenFileDialog();
            if (oFD.ShowDialog() == DialogResult.OK)
            {
                


                //file selected so open to read it
                StreamReader oSR = new StreamReader(oFD.OpenFile());
                int Records = int.Parse(oSR.ReadLine());
                //size Colours array
                Colours = new int[Records];
                //loop through each line to store mark in array
                for (int i = 0; i < Colours.Length; i++)
                {
                    Colours[i] = int.Parse(oSR.ReadLine());
                    

                }



            }
looking at this portion, I'm not sure how to set all my code to be unselected
image.png
A tool for sharing your source code with the world!
Was this page helpful?