Why im getting exception: ndex was out of range?
===

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

I have the class WireObjectAnimation:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.IO;
    using System.Windows.Forms;
    using DannyGeneral;
    
    namespace AnimationEditor
    {
        class WireObjectAnimation
        {
            private List<WireObjectCoordinates> wocl = new List<WireObjectCoordinates>();
           
            private WireObject wo1 = null;
            
            string name;
            int ndx;
            public WireObjectAnimation(string name,WireObject wo)
            {
    
                this.name = name;
                
                wo1 = wo;
    
                WireObjectCoordinates woc;
                woc = new WireObjectCoordinates(wo.woc);
                wocl.Add(woc);
                ndx = 0;
               
            }
    
            
    
            
    
            public void Save(string path , string fileName , PictureBox pb) 
            {
                int framesNumberX = 0;
                int framesNumberY = 0;
                string fn;
                string t = Path.GetFileNameWithoutExtension(this.name);
                if (File.Exists(path + "\\" + "DATABASE" + "\\" + fileName + "\\" + t + ".txt"))
                {
                    try
                    {
                        string f = Path.Combine(path + "\\" + "DATABASE" + "\\" + t + "\\" + fileName);
                        File.Delete(f);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Error: Could not delete file from disk. Original error: " + ex.Message);
                    }
    
    
                    fn = path + "\\" + "DATABASE" + "\\" + t + "\\" + fileName;
                }
                else
                {
                    fn = path + "\\" + "DATABASE" + "\\" + fileName + "\\" + this.name + ".txt";
                }
                OptionsFile setting_file = new OptionsFile(fn);
                setting_file.SetKey("File Name", fn);
                setting_file.SetKey("Object Name", fileName);
                setting_file.SetKey("Animation Name", this.name);
                setting_file.SetKey("picturebox.Width", pb.Width.ToString());
                setting_file.SetKey("picturebox.Height", pb.Height.ToString());
    
                string[] xFrames = new string[wocl.Count];
                string[] yFrames = new string[wocl.Count];
                
                string X="";
                string Y="";
                for (int i = 0; i < wocl.Count; i++)
                {
                    X  = string.Format("Frame_X_{0} ", i + 1);
                    Y  = string.Format("Frame_Y_{0} ", i + 1);
                    framesNumberX ++;
                    framesNumberY ++;
                    for (int j = 0; j < wocl[i].Point_X.Count; j++)
                    {
                        xFrames[i] += string.Format("{0},", wocl[i].Point_X[j]);
                        yFrames[i] += string.Format("{0},", wocl[i].Point_Y[j]);
                        
                       
                    }
    
                    string tt = xFrames[i].Trim(",".ToCharArray());
                    string yy =  yFrames[i].Trim(",".ToCharArray());
    
    
    
                     setting_file.SetKey(X, tt);
                     setting_file.SetKey(Y, yy);
                     
                }
    
                int resultX = framesNumberX / 2;
                int resultY = framesNumberY / 2;
                setting_file.SetKey("Number Of Frames X", resultX.ToString()); 
                setting_file.SetKey("Number Of Frames Y", resultY.ToString());
    
    
                   
                    
    
    
                
            }
    
    
            public void Load(string path,string fileName)
            {
                int numberofframesX = 0;
                int numberofframesY = 0;
                string framesX = "";
                string framesY = "";
                string X = "";
                string Y = "";
                string t = path + "\\" + fileName;
                OptionsFile setting_file = new OptionsFile(t);
                string XX = setting_file.GetKey("Number Of Frames X");
                string YY = setting_file.GetKey("Number Of Frames Y");
                numberofframesX = Convert.ToInt32(XX);
                numberofframesY = Convert.ToInt32(YY);
    
    
                for (int i = 1; i < numberofframesX ; i++)
                {
                X  = string.Format("Frame_X_{0} ", i);
                framesX = setting_file.GetKey(X);
                List<string> floatStrings = new List<string>(framesX.Split(new char[] { ',' }));
                List<float> test = floatStrings.Select(tempStr => (float)Convert.ToDouble(tempStr)).ToList(); 
                
    
                    wo1.woc.Point_X = test;  
    
                }
                for (int i = 1; i < numberofframesY; i++)
                {
                    Y = string.Format("Frame_Y_{0} ", i);
                    framesY = setting_file.GetKey(Y);
                    List<string> floatStrings = new List<string>(framesY.Split(new char[] { ',' }));
                    List<float> test = floatStrings.Select(tempStr => (float)Convert.ToDouble(tempStr)).ToList();
                    wo1.woc.Point_Y = test;
                }
            }
    
    
            public void SetFrame(int frameNumber, WireObjectCoordinates woc)
            {
                wocl[frameNumber].Set(woc);
            }
    
            public WireObjectCoordinates GetFrame(int frameNumber)
            {
                if (frameNumber > wocl.Count)
                {
                    throw new Exception("not allowed!");
                }
    
                if (frameNumber == wocl.Count)
                {
                    WireObjectCoordinates woc;
                    woc = new WireObjectCoordinates(wocl[wocl.Count - 1]); 
                   
                    wocl.Add(woc);
                    return woc;
                }
                else
                {
    
                    return wocl[frameNumber];
                }
                   
    
            }
        }
    }


Now when im doing loading the Load function i see the points its loading it good.
But then im trying to move the trackBar bar scroll to the right and then im getting the exception. Now thisl ine:  wo1.woc.Point_X = test;  the woc have 4 indexs and in each index Point_X and Point_Y are filled with numbers in each index.

In this class i have the functions SetFrame and GetFrame and im using GetFrame in Form1 scroll event of the trackBar:

 

    private void trackBar1_Scroll(object sender, EventArgs e)
            {
    
                currentFrameIndex = trackBar1.Value;
                textBox1.Text = "Frame Number : " + trackBar1.Value;
                wireObject1.woc.Set(wireObjectAnimation1.GetFrame(currentFrameIndex)); 
                LoadPictureAt(trackBar1.Value, sender);
    
                button1.Enabled = false;
                button2.Enabled = false;
                button3.Enabled = false;
                button4.Enabled = false;
                button8.Enabled = false;
                SaveFormPicutreBoxToBitMapIncludingDrawings();
    
                return;
    
    
                
                    
               
    
                   
                      
                
            }

Now when im moving the trackBar once to the right it should paint the next set of numbers from the Point_X and Point_Y instead its going to the WireObjectCoordinates class and throw there the exception:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace AnimationEditor
    {
        class WireObjectCoordinates
        {
            public List<float> Point_X = new List<float>();
            public List<float> Point_Y = new List<float>();
    
            public WireObjectCoordinates()
            {
            }
    
            public WireObjectCoordinates(WireObjectCoordinates w)
            {
                Point_X.AddRange(w.Point_X);
                Point_Y.AddRange(w.Point_Y);
            }
    
            public void Set(WireObjectCoordinates w)
            {
                for (int i = 0; i < Point_X.Count; i++)
                {
                    Point_X[i] = w.Point_X[i];
                    Point_Y[i] = w.Point_Y[i];
                }
            }
        }
    }


The exception is on the line: Point_X[i] = w.Point_X[i];
Point_X[i] contain now 4 indexs from [0] to [3] each index contain a number like 332.0 333.0 334.0 335.0
And w.Point_X[i] contain now only one index [0] and this index have the number 332.0 

i just dont understand why the exception is on this line.

The idea is that when im moving the trackBar to the right it should draw the next coordinates from the  wo1.woc.Point_Y and  wo1.woc.Point_X but i guess i did something wrong in the Load function ? Im not sure why its throwing the exception and its only when im moving the trackBar to the right once.
