I had question about the array in an other post and figure for the most part, but I honestly stuck on what do at the moment with my project because I can get my test scores to show up correctly, so I must be doing something wrong.

Can someone take a look and maybe point me in the correct direction again?

Student Class:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace maint_student_scores
{
    public class student
    {
        public string name { get; set; }
        
        public List<int> Scores = new List<int>();

        public int scoreTotal()
        {
            int Total = 0;
            foreach (int score in Scores)
            {
                Total += score;
            }
            return Total;           
        }

        public static int averageAllStudents(List<student> Students)
        {
            int totalScores = 0; //total scores init. for students
            int totalCount = 0; //total count of scores  init. for all students

            //our favor command foreach in an array
            foreach (student s in Students)
            {
                foreach (int score in s.Scores)
                {
                    totalScores += score;
                    totalCount++;
                }
            }
            return totalScores / totalCount;
        }

        public int scoreCount()
        {
           return Scores.Count;
        }

        public void addScore(int Score)
        {
           Scores.Add(Score);
        }

        public void editScore(int Score, int index)
        {
            Scores.Remove(index);
            Scores.Insert(index, Score);
        }

        public void deleteScore(int index)
        {
           Scores.Remove(index);
            
        }
    }
}

MainForm:

namespace maint_student_scores
{
    public partial class maintain_student_scores : Form
    {
        List<student> Students;

        public maintain_student_scores()
        {
            InitializeComponent();
        }

        private void maintain_student_scores_Load(object sender, EventArgs e)
        {
            Students = new List<student>();  //create our student list

            Students = new List<student>(); // create the list

            // add some items so we can see in the listview test on Form2
            student s1 = new student();
            s1.name = "George Carnegie";
            s1.Scores.Add(100);
            s1.Scores.Add(95);
            Students.Add(s1);

            student s2 = new student();
            s2.name = "Bill Butler";
            s2.Scores.Add(85);
            s2.Scores.Add(79);
            Students.Add(s2);
        }

        private void addBtn_Click(object sender, EventArgs e)
        {
            newstudent newStudentFrm = new newstudent(Students);
            newStudentFrm.ShowDialog();
        }

        private void updateBtn_Click(object sender, EventArgs e)
        {
            scoreupdate scoreupdateFrm = new scoreupdate(Students);
            scoreupdateFrm.ShowDialog();
        }

        private void deleteBtn_Click(object sender, EventArgs e)
        {
            
        }

        private void exitBtn_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void scoretotalTbox_TextChanged(object sender, EventArgs e)
        {

        }

        
    }
}

NewStudentForm:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace maint_student_scores
{
    public partial class newstudent : Form
    {
        List<student> Students;

        public newstudent(List<student> Students)
        {
            InitializeComponent();

            this.Students = Students;
        }

        private void cancelBtn_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void newstudent_Load(object sender, EventArgs e)
        {

        }

        private void addscoreBtn_Click(object sender, EventArgs e)
        {

        }

        private void clearscoresBtn_Click(object sender, EventArgs e)
        {

        }

        private void okBtn_Click(object sender, EventArgs e)
        {

        }
    }
}

UpdateScoreForm:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace maint_student_scores
{
    public partial class scoreupdate : Form
    {
        List<student> Students;

        public scoreupdate(List<student> Students)
        {
            InitializeComponent();

            this.Students = Students;
        }

        private void updatescores_Load(object sender, EventArgs e)
        {
            foreach (student s in Students)
                        
            scoreList.Items.Add(new ListViewItem(s.ToString()));
            
        }

        private void cancelBtn_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void clearscoresBtn_Click(object sender, EventArgs e)
        {
           
        }

        private void okBtn_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void addBtn_Click(object sender, EventArgs e)
        {
            updatescores_add updateScoresAddFrm = new updatescores_add(Students);
            updateScoresAddFrm.ShowDialog();
        }

        private void updateBtn_Click(object sender, EventArgs e)
        {
            updatescores_update updateScoresUpdateFrm = new updatescores_update(Students);
            updateScoresUpdateFrm.ShowDialog();
        }

        
    }
}

and I have those two form but I won't post them because I'm pretty sure if I get pointed in the right direction I'll be able to see the light and understand those.

So couple questions I have:
1) Did I correctly add the test student data and why is it not showing up correctly (give me nothing but ListViewItem blah blah blah).
2) If you add a newstudent with the form and you click ok how do you save it to the array.
Those are mainly my two questions I'm not sure about how to do. I know the clearing is just selecting the index (one that currently selected) and doing the remove method.

Thanks for any help.

Hey, im about to nip out so i havent got time to go through it thoroughyl..but at first glance i noticed your calling the s.ToString() when you add the student to the list view.

You haven't overriden that method so it will be calling the base method.

In student class add:

public override string ToString()
        {
            return name;
        }

try that for now..i'll take a closer look when i get in if you need it :)

Hey, im about to nip out so i havent got time to go through it thoroughyl..but at first glance i noticed your calling the s.ToString() when you add the student to the list view.

You haven't overriden that method so it will be calling the base method.

In student class add:

public override string ToString()
        {
            return name;
        }

try that for now..i'll take a closer look when i get in if you need it :)

DOH!!!! Something simple that I overlooked.

I hope you don't mind me taking this step by step because this is my first time dealing with multiforms and the book I'm using really isn't helping me lately with these projects :S.

Anywho...
Where I'm getting stuck now is that I'm working on my add new student form:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace maint_student_scores
{
    public partial class newstudent : Form
    {
        List<student> Students;

        public newstudent(List<student> Students)
        {
            InitializeComponent();

            this.Students = Students;
        }

        private void cancelBtn_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void newstudent_Load(object sender, EventArgs e)
        {

        }

        private void addscoreBtn_Click(object sender, EventArgs e)
        {
            //check to make sure the box isn't empty.
            if (scoreTbox.Text == string.Empty)
            {
                scoreTbox.Focus();
                return;
            }

            //get input from scoreTbox.
            int Score = int.Parse(scoreTbox.Text);

            
        }

        private void clearscoresBtn_Click(object sender, EventArgs e)
        {

        }

        private void okBtn_Click(object sender, EventArgs e)
        {

        }
    }
}

I'm confused on how to add\store the score when you click the add score button. I know normally it should be Scores.Add(Score); as that would be my array, but since its not on the same page as the form i'm unsure how to call it? If I can figure this out I think I'll have a better idea of how to call\update the other functions of edit\add.

Thank you.

Ah ha!!!! Played around with it a bit more and I believe I have figured it out.

Forgot to add a public student testscores = new student; to the top of my form to allow me to call functions from the student class. I'll post if I manage to break things and confuse myself again.

Thanks.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace maint_student_scores
{
    public partial class newstudent : Form
    {
        public student testscores = new student();
        List<student> Students;

        public newstudent(List<student> Students)
        {
            InitializeComponent();

            this.Students = Students;
        }

        private void cancelBtn_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void newstudent_Load(object sender, EventArgs e)
        {

        }

        private void addscoreBtn_Click(object sender, EventArgs e)
        {
            //check to make sure the box isn't empty.
            if (scoreTbox.Text == string.Empty)
            {
                scoreTbox.Focus();
                return;
            }

            //get input from scoreTbox.
            int Score = int.Parse(scoreTbox.Text);

            testscores.addScore(Score);  
        }

        private void clearscoresBtn_Click(object sender, EventArgs e)
        {
            
        }

        private void okBtn_Click(object sender, EventArgs e)
        {

        }
    }

I am really throughly confused on my project and how to bring data across forms and how to get them to show up in textboxes now, can someone maybe explain it in simpler terms or example it so I might understand it better?

Sure. Here is the information I need:
1) Explanation of what the newstudent form is supposed to do; I know you are using multi-forms for this project, so specifically what the "newstudent" form's purpose is...
2) post the code from the newstudent.designer.cs file

Ok I attached the project of what I have to do.

The newstudent form:
It allows the user (me) to add a new student to my array, attached scores and then have those new scores be shown in the textbox: Scores:
The attach picture should explain the form better the idea of what is going on.

The code I have for it right now is as follows:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace maint_student_scores
{
    public partial class newstudent : Form
    {
        public student testscores = new student();
        List<student> Students;

        public newstudent(List<student> Students)
        {
            InitializeComponent();

            this.Students = Students;
        }

        private void cancelBtn_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void newstudent_Load(object sender, EventArgs e)
        {

        }

        private void addscoreBtn_Click(object sender, EventArgs e)
        {
            //check to make sure the box isn't empty.
            if (scoreTbox.Text == string.Empty)
            {
                scoreTbox.Focus();
                return;
            }

            //get input from scoreTbox.
            int Score = int.Parse(scoreTbox.Text);

            testscores.addScore(Score);  
        }

        private void clearscoresBtn_Click(object sender, EventArgs e)
        {
            
        }

        private void okBtn_Click(object sender, EventArgs e)
        {

        }
    }
}

The designer code:

namespace maint_student_scores
{
    partial class newstudent
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.addscoreBtn = new System.Windows.Forms.Button();
            this.nameLlb = new System.Windows.Forms.Label();
            this.scoreLlb = new System.Windows.Forms.Label();
            this.scoresLlb = new System.Windows.Forms.Label();
            this.nameTbox = new System.Windows.Forms.TextBox();
            this.scoreTbox = new System.Windows.Forms.TextBox();
            this.scoresTbox = new System.Windows.Forms.TextBox();
            this.clearscoresBtn = new System.Windows.Forms.Button();
            this.okBtn = new System.Windows.Forms.Button();
            this.cancelBtn = new System.Windows.Forms.Button();
            this.SuspendLayout();
            // 
            // addscoreBtn
            // 
            this.addscoreBtn.Location = new System.Drawing.Point(162, 40);
            this.addscoreBtn.Name = "addscoreBtn";
            this.addscoreBtn.Size = new System.Drawing.Size(75, 23);
            this.addscoreBtn.TabIndex = 0;
            this.addscoreBtn.Text = "Add Score";
            this.addscoreBtn.UseVisualStyleBackColor = true;
            this.addscoreBtn.Click += new System.EventHandler(this.addscoreBtn_Click);
            // 
            // nameLlb
            // 
            this.nameLlb.AutoSize = true;
            this.nameLlb.Location = new System.Drawing.Point(13, 13);
            this.nameLlb.Name = "nameLlb";
            this.nameLlb.Size = new System.Drawing.Size(35, 13);
            this.nameLlb.TabIndex = 1;
            this.nameLlb.Text = "Name";
            // 
            // scoreLlb
            // 
            this.scoreLlb.AutoSize = true;
            this.scoreLlb.Location = new System.Drawing.Point(12, 40);
            this.scoreLlb.Name = "scoreLlb";
            this.scoreLlb.Size = new System.Drawing.Size(35, 13);
            this.scoreLlb.TabIndex = 2;
            this.scoreLlb.Text = "Score";
            // 
            // scoresLlb
            // 
            this.scoresLlb.AutoSize = true;
            this.scoresLlb.Location = new System.Drawing.Point(13, 71);
            this.scoresLlb.Name = "scoresLlb";
            this.scoresLlb.Size = new System.Drawing.Size(40, 13);
            this.scoresLlb.TabIndex = 3;
            this.scoresLlb.Text = "Scores";
            // 
            // nameTbox
            // 
            this.nameTbox.Location = new System.Drawing.Point(54, 13);
            this.nameTbox.Name = "nameTbox";
            this.nameTbox.Size = new System.Drawing.Size(183, 20);
            this.nameTbox.TabIndex = 4;
            // 
            // scoreTbox
            // 
            this.scoreTbox.Location = new System.Drawing.Point(54, 40);
            this.scoreTbox.Name = "scoreTbox";
            this.scoreTbox.Size = new System.Drawing.Size(93, 20);
            this.scoreTbox.TabIndex = 5;
            // 
            // scoresTbox
            // 
            this.scoresTbox.Location = new System.Drawing.Point(60, 71);
            this.scoresTbox.Name = "scoresTbox";
            this.scoresTbox.ReadOnly = true;
            this.scoresTbox.Size = new System.Drawing.Size(177, 20);
            this.scoresTbox.TabIndex = 6;
            // 
            // clearscoresBtn
            // 
            this.clearscoresBtn.Location = new System.Drawing.Point(162, 97);
            this.clearscoresBtn.Name = "clearscoresBtn";
            this.clearscoresBtn.Size = new System.Drawing.Size(75, 23);
            this.clearscoresBtn.TabIndex = 7;
            this.clearscoresBtn.Text = "Clear Scores";
            this.clearscoresBtn.UseVisualStyleBackColor = true;
            this.clearscoresBtn.Click += new System.EventHandler(this.clearscoresBtn_Click);
            // 
            // okBtn
            // 
            this.okBtn.Location = new System.Drawing.Point(72, 125);
            this.okBtn.Name = "okBtn";
            this.okBtn.Size = new System.Drawing.Size(75, 23);
            this.okBtn.TabIndex = 8;
            this.okBtn.Text = "OK";
            this.okBtn.UseVisualStyleBackColor = true;
            this.okBtn.Click += new System.EventHandler(this.okBtn_Click);
            // 
            // cancelBtn
            // 
            this.cancelBtn.Location = new System.Drawing.Point(162, 125);
            this.cancelBtn.Name = "cancelBtn";
            this.cancelBtn.Size = new System.Drawing.Size(75, 23);
            this.cancelBtn.TabIndex = 9;
            this.cancelBtn.Text = "Cancel";
            this.cancelBtn.UseVisualStyleBackColor = true;
            this.cancelBtn.Click += new System.EventHandler(this.cancelBtn_Click);
            // 
            // newstudent
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(254, 157);
            this.Controls.Add(this.cancelBtn);
            this.Controls.Add(this.okBtn);
            this.Controls.Add(this.clearscoresBtn);
            this.Controls.Add(this.scoresTbox);
            this.Controls.Add(this.scoreTbox);
            this.Controls.Add(this.nameTbox);
            this.Controls.Add(this.scoresLlb);
            this.Controls.Add(this.scoreLlb);
            this.Controls.Add(this.nameLlb);
            this.Controls.Add(this.addscoreBtn);
            this.Name = "newstudent";
            this.Text = "New Student";
            this.Load += new System.EventHandler(this.newstudent_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Button addscoreBtn;
        private System.Windows.Forms.Label nameLlb;
        private System.Windows.Forms.Label scoreLlb;
        private System.Windows.Forms.Label scoresLlb;
        private System.Windows.Forms.TextBox nameTbox;
        private System.Windows.Forms.TextBox scoreTbox;
        private System.Windows.Forms.TextBox scoresTbox;
        private System.Windows.Forms.Button clearscoresBtn;
        private System.Windows.Forms.Button okBtn;
        private System.Windows.Forms.Button cancelBtn;
    }
}

EvilLinux, thanks for including the doc. Since I will probably be spending some time helping you get through this and to understand how it works and pieces together, would you mind just zipping up the entire project for me?

Thank you very much for taking the time to help me with this. My friends (who are pretty good at programming compared to me) couldn't figure it out, they got me a little farther than I last left off, but this project is confusing, and the next one after this requires me to write the data to a file (which looks to be easier) its the fact of getting this whole thing going :S.

Ok, up and running and you already solved getting the score added.

What is the next question you have?

Ok, up and running and you already solved getting the score added.

What is the next question you have?

How do I pull the scores to show as a string to textboxes?
I.E. each time they are added I would like them to show on the textbox below the enter part of it on the newstudent form.
My best guess is that I got to run a foreach (something s in something) { set the string here }. I just not sure of the foreach where to pull.

Just loop through all of your scores and append them to a string.

// build a string of all scores separated with space char
            string text = "";
            for (int i = 0; i < testscores.Scores.Count; i++)
                text += " " + testscores.Scores[i];

Now all you have to do is set your textbox: scoresTBox.Text = text

Gosh that couldn't have been easier to figure out, I forget about the if (stuff here), I keep always thinking to run foreach with arrays.

Ok so my next one would be how would I store the name + the scores so that it is saved and accessible to the main form? Or since the student.cs is control the array is it already storing everything there?

Students.Add(testscores);

Now, Students list passed in from the main form will have the new student added and available to any form you pass in the Student list.

Students.Add(testscores);

Now, Students list passed in from the main form will have the new student added and available to any form you pass in the Student list.

Ok catch for the add scores button.

Updated:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace maint_student_scores
{
    public partial class newstudent : Form
    {
        public student testscores = new student();
        List<student> Students;

        public newstudent(List<student> Students)
        {
            InitializeComponent();

            this.Students = Students;
        }

        private void cancelBtn_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void newstudent_Load(object sender, EventArgs e)
        {

        }

        private void addscoreBtn_Click(object sender, EventArgs e)
        {
            //check to make sure the box isn't empty.
            if (scoreTbox.Text == string.Empty)
            {
                scoreTbox.Focus();
                return;
            }

            //get input from scoreTbox.
            int Score = int.Parse(scoreTbox.Text);

            //add test scores to testscore array.
            testscores.addScore(Score);
            
            string text = "";
            for (int i = 0; i < testscores.Scores.Count; i++)
                text += " " + testscores.Scores[i];
            scoresTbox.Text = text;

            //add score to student array.
            Students.Add(testscores);
        }

        private void clearscoresBtn_Click(object sender, EventArgs e)
        {
            
        }

        private void okBtn_Click(object sender, EventArgs e)
        {
            
        }
    }
}

Here I think the final question for this form. I have to create something that saves the name to the student array, because you showed me that the score data is saved to the testscores and then added to the student, so it becomes the students score. Now on the ok click you would have to create something that will save the name and show it back on the main form correct?

Would you use another for statement or something else?

And to clear the scores you can use:

private void clearscoresBtn_Click(object sender, EventArgs e)
        {
            testscores.Scores.Clear();
        }

Correct?

1) Yes on the Clear() method...
2) I wouldn't add this student to the Students list until they press the OK button; what if they press Cancel?
3) You really don't need to add the student's name to anything until they press the OK button: testscores.name = nameTbox.Text . You need to do that before you add testscores to your Students list though...

1) Yes on the Clear() method...
2) I wouldn't add this student to the Students list until they press the OK button; what if they press Cancel?
3) You really don't need to add the student's name to anything until they press the OK button: testscores.name = nameTbox.Text . You need to do that before you add testscores to your Students list though...

Cool this is making sense, can you take a look at this and tell me if I'm doing it correctly?
I understand your #2, but #3 I believe I did it right because code is read from top to bottom so if I put that after the score adding it wouldn't work correct right?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace maint_student_scores
{
    public partial class newstudent : Form
    {
        public student testscores = new student();
        List<student> Students;

        public newstudent(List<student> Students)
        {
            InitializeComponent();

            this.Students = Students;
        }

        private void cancelBtn_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void newstudent_Load(object sender, EventArgs e)
        {

        }

        private void addscoreBtn_Click(object sender, EventArgs e)
        {
            {
            
                //check to make sure the box isn't empty.
                if (scoreTbox.Text == string.Empty)
                {
                    scoreTbox.Focus();
                    return;
                }

                testscores.name = nameTbox.Text;

                //get input from scoreTbox.
                int Score = int.Parse(scoreTbox.Text);

                //add test scores to testscore array.
                testscores.addScore(Score);

                string text = "";
                for (int i = 0; i < testscores.Scores.Count; i++)
                    text += " " + testscores.Scores[i];
                scoresTbox.Text = text;

            }
        
        }
        

        private void clearscoresBtn_Click(object sender, EventArgs e)
        {
            testscores.Scores.Clear();
            scoreTbox.Text = "";
            scoresTbox.Text = "";
        }

        private void okBtn_Click(object sender, EventArgs e)
        {
            Students.Add(testscores);
            this.Close();
        }
    }
}

What you have shown should work fine. I only suggested adding the name assignment in the OK button event because there is no need to add the name every time the user adds another score for that student--bad coding practice. So, I still suggest waiting until user presses OK to add name:

private void okBtn_Click(object sender, EventArgs e)
        {
            testscores.name = nameTbox.Text;
            Students.Add(testscores);
            this.Close();
        }

What you have shown should work fine. I only suggested adding the name assignment in the OK button event because there is no need to add the name every time the user adds another score for that student--bad coding practice. So, I still suggest waiting until user presses OK to add name:

private void okBtn_Click(object sender, EventArgs e)
        {
            testscores.name = nameTbox.Text;
            Students.Add(testscores);
            this.Close();
        }

ok yeah thats clearer. I was thinking that the name had to be created before the scores could be added. But I forgot that there is a Student LIST and a Scores LIST, two different things.

I'm think we're done with the newstudent box, it looks to be all good and working.

I guess move onto the scoreupdate section.
I'm going to give this a stab with some code because I have some clue on what some functions need to do:

Here is what I figured from the previous posting on how to update and make functions work:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace maint_student_scores
{
    public partial class scoreupdate : Form
    {
        public student testscores = new student();
        List<student> Students;
        
        public scoreupdate(List<student> Students)
        {
            InitializeComponent();

            this.Students = Students;
        }

        private void updatescores_Load(object sender, EventArgs e)
        {
            
            
        }

        private void cancelBtn_Click(object sender, EventArgs e)
        {
            //Close this box!
            this.Close();
        }

        private void clearscoresBtn_Click(object sender, EventArgs e)
        {
            //Lets clear all scores listed in our box!
            testscores.Scores.Clear();
        }

        private void okBtn_Click(object sender, EventArgs e)
        {
            //lets add the name to our list!
            testscores.name = nameTbox.Text;
            //make sure they get their scores also!
            Students.Add(testscores);
            //And we'll close this box so its out of the way and saved to our list.
            this.Close();
        }

        private void addBtn_Click(object sender, EventArgs e)
        {
            updatescores_add updateScoresAddFrm = new updatescores_add();
            updateScoresAddFrm.ShowDialog();
        }

        private void updateBtn_Click(object sender, EventArgs e)
        {
            updatescores_update updateScoresUpdateFrm = new updatescores_update();
            updateScoresUpdateFrm.ShowDialog();
        }

        private void removeBtn_Click(object sender, EventArgs e)
        {

        }

        private void studentnameTbox_TextChanged(object sender, EventArgs e)
        {
            Students.ToString();
        }

        
    }
}

Here my new questions:
1)When the users clicks the update button bring up the update form they enter a new value from the previous. Two things: 1 do I bring up the score with an index (I'm going to guess yes, and how?) and I have the function already for editScore would I just use testscores.editScore() 2) I guess this would be the same as above but how would you pull the name, I figure you figure one you figure both.
3) testscores.deleteScore(); I have to figure the index or select from the form correct?

I think that basically the general question for this one, I figured the add score can take from the new student its just basically adding another score to the current student with the same method.

Thank you.

You could do this either way: List with index; or, pass in the student

How would like to do it?

You could do this either way: List with index; or, pass in the student

How would like to do it?

I think pass in the student would be easy to keep with the array. Is there a recommended way or a preference for programmers?

Every programmer develops there own preferences, and if you become a programmer on a team, you will want to follow any patterns already in use by the team, or company, which might dictate one way over another.

In this case, lets pass in a student to the form, so you can see that technique...

So first, do you know the index of the student you need to update?

Every programmer develops there own preferences, and if you become a programmer on a team, you will want to follow any patterns already in use by the team, or company, which might dictate one way over another.

In this case, lets pass in a student to the form, so you can see that technique...

So first, do you know the index of the student you need to update?

Well with an array the index always starts at 0. I guess another question before I start going crazy on this is that I just have the two student names there as place hold data and will be removed at the end and then when the form is build the data will have to be reentered?
So I'm going to guess the index we would want to start with is 0 and then depending where the clicks\selects we have to select that index correct?

Let's start at the beginning...

On your main form, you have your listbox loaded with the students (name and scores). Since you load this listbox from your list in the same order as your Students list, all you need to do is know the index of the selected item in the listbox to access that student in your list.

Do you know how to get the selected index from the selected item in the listbox?

Let's start at the beginning...

On your main form, you have your listbox loaded with the students (name and scores). Since you load this listbox from your list in the same order as your Students list, all you need to do is know the index of the selected item in the listbox to access that student in your list.

Do you know how to get the selected index from the selected item in the listbox?

Students.IndexOf ? I'm not totally sure.
I know like selectstudent = student[0] would be index 0 of student.

We are working with the GUI (form) interface right now, and not the Students list yet. Do you know how to retrieve the selected item from the studentList textbox on your main form: maintain_student_scores ?

We are working with the GUI (form) interface right now, and not the Students list yet. Do you know how to retrieve the selected item from the studentList textbox on your main form: maintain_student_scores ?

No I'm not sure how.

OK. Here is the code to get the selected item's index:

int index = studentList.SelectedIndex;

Now that you know the index, you need to get a reference to the specific student in the Students list. Do you know how to do that?

You showed how to get the first student as Students[0], but now we want declare a variable that references the specific student...

OK. Here is the code to get the selected item's index:

int index = studentList.SelectedIndex;

Now that you know the index, you need to get a reference to the specific student in the Students list. Do you know how to do that?

You showed how to get the first student as Students[0], but now we want declare a variable that references the specific student...

int student = studentList.SelectedItem;

Because would I select the item from the studentList?
Taking a bit of a guess on this.

You need to watch how you name things. You don't want to declare variables with names that could conflict with other identifiers...

Here is what you need to do in the update button's event handler:

int index = studentList.SelectedIndex; // index of listbox same as Students...
            student updateStudent = Students[index]; // retrieve student to udpate
            scoreupdate scoreupdateFrm = new scoreupdate(updateStudent); // pass student to update form
            scoreupdateFrm.ShowDialog(); // show the form...

Now, once you put that in there, the constructor for the scoreupdate form needs to be changed to take "student" as parameter, instead of "List<student>". Also, instead of holding a reference to Students, you now need to set a reference to "updateStudent" passed into the form's constructor.

So make those changes and let me know when you are done.

Also, at some point I would like to go through with you in renaming your definitions to be more meaningful and specific to what they are because when the names don't represent closely exactly what they are, it easy to get confused...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.