DdoubleD 315 Posting Shark

I can assure you that the index out of range, based on the code I saw, was/is not being caused by lack of memory.

EDIT: You know that when you are debugging this you can look at the list Count property and the value of the index where the error is thrown. You will see the index is >= to Count, or is less than 0, all of which indicate an improper index out of range.

DdoubleD 315 Posting Shark

Reverse engineer the problem... I have shown you how to get the information into the form and you have a reference to the student's Scores and an index of the score being edited. Look how the constructor pulled the student's score, then just reverse that process to put the update in there.

If you are going to be a programmer, or claim to have learned these skills, you need to pick up these fundamentals and begin thinking in a logical manner to figure things like this out.

I really don't know what else to do if you cannot figure this out; other than to write you application for you, but I'm not going to do that and I hope that is not what you want.

DdoubleD 315 Posting Shark

I'm glad if you understand--very good. Before you get side-tracked, Here are some more changes I want you to make, then you can disappear for a while (LOL) while you produce the remaining implementation...

public partial class UpdateScoreForm : Form
    {
        // no need to know about the other form...
        //private UpdateStudentForm parentForm; //current form

        // Score list and index to score being edited
        private int index; //index of score
        private List<int> Scores;

        // Pass in Score list and index to score being edited...
        // The reason we don't just pass in the single score, is because simple
        // types are passed in by value and the result would be lost...
        // There are other ways we could have done this, but let's keep it simple for now...
        public UpdateScoreForm(int index, List<int> Scores)//UpdateStudentForm parentForm, int index)  //pull score from previous form.
        {
            //this.parentForm = parentForm;

            // this.Scores is a reference to Scores passed in, so when we update it,
            // the change will appear in the caller's list too...
            this.index = index;
            this.Scores = Scores;

            InitializeComponent();

            //this.CurrentScore.Text = this.parentForm.GetScoreAtIndex(index).ToString();

            // Set textbox (naming conventions!) to correct score value...
            this.CurrentScore.Text = Scores[index].ToString();
        }

Then in calling form:

private void UpdateScoresButton_Click(object sender, EventArgs e)
        {
            // get the index of selected listbox item (score)...
            // Again, use naming conventions for a listbox...
            int index = CurrentScores.SelectedIndex;
            
            // ensure there is a score selected, or there is nothing to update...
            System.Diagnostics.Debug.Assert (index >= 0);
            
            List<int> scores = studentToEdit.GetScores();

            // ensure the …
DdoubleD 315 Posting Shark

I need to get you to a good starting point. Begin by making these changes. Do not remove the comments at this time because I want you to be able to look back and reflect at what we did:

public partial class UpdateStudentForm : Form
    {
        // You don't need to know about the parent form!!!
        //private Form1 parentForm;  //main form
        
        private Student studentToEdit; //student list
        
        // there is no need to carry around this index, which can cause you index out of range too.
        //private int index; //index

        // this form only needs to know about this student to udpate...
        public UpdateStudentForm(Student updateStudent)
        {
            // set this form's student reference to one passed in...
            this.studentToEdit = updateStudent;

            InitializeComponent();

            // OK--setting textbox for name and listbox for scores...
            this.StudentName.Text = this.studentToEdit.Name;
            UpdateScoreDisplay();
        }

And in main Form1,...

private void updateStudent_Click_1(object sender, EventArgs e)
        {
            // Get the index of the currently selected student in the ListBox
            // Remember naming conventions: students s/b something 
            // like: lbxStudents or listBoxStudents or lbStudents etc...
            int index = students.SelectedIndex;
            
            // ensure this index is valid and in range with our list...
            System.Diagnostics.Debug.Assert(index >= 0 && index < studentList.Count);

            // Get a reference to the selected student in the studentList...
            Student updateStudent = studentList[index];

            // Pass in only the student we are updating...
            UpdateStudentForm updateStudentForm = new UpdateStudentForm(updateStudent);

            // Create form and show as modeless! (ShowDialog())
            updateStudentForm.ShowDialog(); //open new form
        }

EDIT: Let me know when you have those changes and can compile …

DdoubleD 315 Posting Shark

I need you to post your zipped up project--current version...

DdoubleD 315 Posting Shark

If you just need to access a student from the List<Student> type (studentList) using the "id" you are passing in (assuming it is a valid index), here is the change:

public Student GetStudent(int id)
        {
            return studentList[id];
        }
DdoubleD 315 Posting Shark

Hi,

I would seriously recommend checking out some of the many tutorials on Regular Expressions. It is a powerful tool to have under your belt.

Heres a function that will check your data and only allow the valid characters you listed. It will return false if there are double digits(if they arent preceeded by a '/'), non-numerics or any '/'s if not followed by 004 or 005.

Hope this helps :)

private bool ValidInput(string input)
        {
            const string regExpr = @"[^\d\s]|(\d*?(?<!\/|\/\d)([0-9]{2})|(\/(?!00(4|5))))";

            System.Text.RegularExpressions.Match m = System.Text.RegularExpressions.Regex.Match(input, regExpr);
            if (m.Success)
            {
                return false;
            }
            else
            {
                return true;
            }
        }

I would probably have spent half a day trying to come up with that pattern--LOL. You seem to be quite adept at creating regex patterns Ryshad. He should +rep you if it works!

DdoubleD 315 Posting Shark

the logic on how to do it, evades me. And I think I must check for IsNumbers and then "/004" "/005"

PortData = "1 2 3 4 5 6 7 8 9 0 /004 /005 /234 234 @ %";
            int index = PortData.IndexOf("1","2","3","4","5","6","7",
"8","9","0","/004","/005");
            if (index > -1)
            {

             }
else
{
MessageBox.Show("Data Corrupt);
}

How is this going to see if there is illegal char's?
Sorry, I do not have a clue hoe to do it

Use Regex to search for legal and illegal patterns in your string. Here is a brief description of doing this: Regular Expressions Usage in C#

You might also find this useful: http://www.regular-expressions.info/

DdoubleD 315 Posting Shark

You have to create a global system hook to capture the window's WM_CONTEXTMENU message and override the default context menu across all applications. Take a look at this thread, which is same conversation about modifying the default system context menu for text editing: custom system context menu. Many people will say you can't do it, but I am betting it can be done. It's not a common thing to do and there is no support for doing this. There is no easy answer.

If you decide to pursue this, you will want to include "global system hook" in your searches. Here is a link to some codeproject examples: Global System Hooks. I did not browse these links and it is possible that one of them might mention your exact request, but I doubt it. Anyway, I hope this steers you in the right direction...

Cheers!

DdoubleD 315 Posting Shark

No worries mate--we all get frustrated sometimes. Looks like you are not giving up and making some headway.

Is there a reason you switched to ArrayList to hold your Student list?

Cheers!

DdoubleD 315 Posting Shark

Here's the thing I am trying to load an arraylist of objects with each object having several text properties. Now if I try to do this with this modified code below, I can see each element of the arraylist but not the properties belonging to each object P. I have read many books over the past few weeks and rewritten the code a lot, but I just can't make this work.

Any takers please.

if (Parts.Length > 0)
                Title = GetTitle(parentName);
            ArrayList ps = new ArrayList();
            for (int counter = 0; counter < Parts.Length - 2; counter++)
            {
                PersonalPhoto P = new PersonalPhoto();
               // PhotoStuff P = new PhotoStuff();
                P.FileName = Parts[counter];
                P.DateTaken = GetDatePictureTaken(temp);
                P.Title = Title[counter];
                ps.Add(P);
            }

To access the items in your ArrayList ps, you need to cast the item back to type PersonalPhoto:

for (int i=0; i<ps.Count; i++)
{
  PersonalPhoto p = (PersonalPhoto)ps[i];
  // Now you can access the PersonalPhoto item's properties (eg. p.FileName)
  Console.WriteLine(p.FileName);
}

As an alternative, you could use a strong-typed List instead of an ArrayList:

List<PersonalPhoto> ps = new List<PersonalPhoto>();

            for (int counter = 0; counter < Parts.Length - 2; counter++)
            {
                PersonalPhoto P = new PersonalPhoto();
                // PhotoStuff P = new PhotoStuff();
                P.FileName = Parts[counter];
                P.DateTaken = GetDatePictureTaken(temp);
                P.Title = Title[counter];
                ps.Add(P);
            }

            // access each List/array element as PersonalPhoto...
            foreach (PersonalPhoto p in ps)
            {
                Console.WriteLine(p.FileName);
                Console.WriteLine(p.Title);
                // .... etc.
            }
            // or using index like:
            for (int i = 0; i < ps.Count; i++)
            {
                Console.WriteLine(ps[i].FileName); …
valter commented: Very helpful, solved for what was for me a difficult problem +3
DdoubleD 315 Posting Shark

Please see this and mark as solved if it answers your question: .NET Remoting Examples...

DdoubleD 315 Posting Shark

Sorry, wrong property. Change to:

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string key = (string)comboBox1.SelectedItem;
            textBox1.Text = dict[key];
        }
DdoubleD 315 Posting Shark

:D It happens to us all. Please mark the thread as solved then.

DdoubleD 315 Posting Shark

Is this what you are looking for:

private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
            {
                // if your item is text, otherwise cast to proper type:
                string text = (string)comboBox1.SelectedItem;
                switch (text)
                {
                    case "disease":
                        textBox1.Text = "malaria";
                        break;
                    case "medication":
                        textBox1.Text = "aspirin";
                        break;
                    case "control":
                        textBox1.Text = "ktrl";
                        break;
                    default:
                        break;

                }
            }

You may wish to consider doing it this way:

Dictionary<string, string> dict = new Dictionary<string,string>();

            public void AddItems()
            {
                dict.Add("desease", "malaria");
                dict.Add("medication", "aspirin");
                dict.Add("control", "ktrl");

                foreach (KeyValuePair<string, string> kv in dict)
                {
                    comboBox1.Items.Add(kv.Key);
                }
            }
            private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
            {
                string key = comboBox1.SelectedText;
                textBox1.Text = dict[key]; // get the value of associated key...
            }
DdoubleD 315 Posting Shark

Add a KeyDown event:

private void textBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (Control.ModifierKeys == Keys.Space)
                ;//spacebar was pressed
        }

Sorry, I just realized I compared apples to oranges somewhat.... Try this instead:

private void textBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Space)
                ;//spacebar was pressed
        }

or, you can also do it this way:

private void textBox_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == ' ')
                ;//spacebar was pressed
        }
DdoubleD 315 Posting Shark

I don't understand. You say you are trying not to delete the files, but you are deleting: System.IO.File.Delete(file); .

When you say the url extension is not visible, what do you mean?

DdoubleD 315 Posting Shark

Good! Please mark as solved.

DdoubleD 315 Posting Shark

Ya well , it can works for all keys, i just want for space key.....

Add a KeyDown event:

private void textBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (Control.ModifierKeys == Keys.Space)
                ;//spacebar was pressed
        }
DdoubleD 315 Posting Shark

I am curious to see how far you have gotten on this. For the "scoreupdate" form, the purpose is to modifiy scores for one student only (selected from the main form). You have passed in the student object whose scores are to be modified: scoreupdate scoreupdateFrm = new scoreupdate(updateStudent) --good. Now, modify the form's events accordingly. Keep in mind:

  • You are not working with the List<student> Students , so this form doesn't need to know about this list, only the student being updated ( updateStudent
  • You are not creating a new student, so you should not be creating a new object of type student
  • You are only modifying the scores, so there is no need to change the updateStudent.name field
  • The scores listbox is loaded using the same/similar techniques that the students listbox were loaded on your main form--just a different List is being used (scores); also how you get the selected item's index from the listbox for the score to edit, delete, etc.

Implement the functionality for this form and remove code that does not belong with this form that you have copied into it from the other form. Once you have implemented these concepts, we can pick up from there where you still need assistance, but you need to put in the effort in order to develop your understanding/skill.

Also, you need to begin using/adhering to some naming conventions; so think about this as you are writing code. The VS IDE also makes …

DdoubleD 315 Posting Shark

Sorry i thought it worked but i see now that i still can't have a autonumber column in my database...? the bulk insert works from the first column onwards and i need to have the autonumber column...Any further suggestions?

Seems to me you could add/insert an autonumber column after the bulk insert completes: How to: Create an Autonumber DataColumn

DdoubleD 315 Posting Shark

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...

DdoubleD 315 Posting Shark

I'm new at this DB stuff using C#, but based on what I've seen, you need to do something like:

OleDbConnection vlAccessConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + DBFileName);

            string cmd_str = "SELECT CurrentPassword FROM AdminPassword WHERE UserName = 'Admin'";

            DataSet ds = new DataSet();

            OleDbDataAdapter da = new OleDbDataAdapter(cmd_str, vlAccessConnection);

            da.Fill(ds);

            // retrieve the CurrentPassword form the DataSet (ds)
DdoubleD 315 Posting Shark

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...

DdoubleD 315 Posting Shark

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 ?

DdoubleD 315 Posting Shark

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?

DdoubleD 315 Posting Shark

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?

DdoubleD 315 Posting Shark

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

How would like to do it?

DdoubleD 315 Posting Shark

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();
        }
DdoubleD 315 Posting Shark

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...

DdoubleD 315 Posting Shark
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.

DdoubleD 315 Posting Shark

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

DdoubleD 315 Posting Shark

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

What is the next question you have?

DdoubleD 315 Posting Shark

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?

DdoubleD 315 Posting Shark

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

DdoubleD 315 Posting Shark

You have not defined "title" for Quote and Photo, so how do you want to handle the scenario when the specific class is not RegularPost?

DdoubleD 315 Posting Shark

That is fine! I get it completely but then how would I access the child members outside the IF statement? While using Intellisense outside the loop, on the item variable, I cannot access the child functions.

My actual question is, how do I access child-specific functions outside the IF statement?

When you call the base class virtual function item.GetPostType() , it will invoke the overridden method from your specific class.

EDIT: Now you have me saying "function"--LOL. C# has methods, not functions... try to use the word "method" instead.

DdoubleD 315 Posting Shark

I have tried using your method but then it does not allow me to access the child-class specific properties after returning the list.

I don't know what you mean by "after returning the list". Here is an example of how you need to access the derived Post class (specific child-class) members, and then you can access the common base class members at the end as you were already doing. Nevermind that I stripped out all of the code not needed for demonstrating this concept.

string type = "regular"; // using to demonstrate given functionality
            
            // Declare object reference to access common base stuff from Post
            // Declaring outside of specific Post derived classes below so we
            // can access the common base information later...
            Post item;

            if (type == "regular")
            {
                RegularPost regPost = new RegularPost();
                item = regPost; // allow item object to access the base class members...

                // you can set title from RegularPost object because it is defined there,...
                regPost.title = "some text";

                // but NOT from the abstract class because that is not where it is defined
                //item.title = "some text"; // this will throw a compile error
            }
            else if (type == "quote")
            {
                Quote quote = new Quote();
                item = quote; // allow item object to access the base class members...

                // these are NOT members of Post, so you cannot set them using Post object
                //item.source = (string)postType.ElementAt(1); // compile error
                //item.text = (string)postType.ElementAt(0);// compile error

                // these are members of Quote, …
DdoubleD 315 Posting Shark
{
            // loading a ListView control with the data...
            foreach (student s in Students)
                listView1.Items.Add(new ListViewItem(s.ToString()/*or s.Name* works too*/));
        }

I get what that is doing, but where are you calling the listView1.Items.Add function from?

Not sure what you mean, because it was being called from the form's Load event until you removed it to ask this question. What are you asking about exactly?

Here is that section of code again:

public partial class Form2 : Form
    {
        List<student> Students;
 
        public Form2(List<student> Students)
        {
            InitializeComponent();
 
            this.Students = Students;
        }
 
        private void Form2_Load(object sender, EventArgs e)
        {
            // loading a ListView control with the data...
            foreach (student s in Students)
                listView1.Items.Add(new ListViewItem(s.ToString()/*or s.Name* works too*/));
        }
    }
DdoubleD 315 Posting Shark

Your welcome and happy coding! Please mark thread as SOLVED if your questions have been answered.

If you run into a problem somewhere, just create a new thread with that problem.

Cheers!

DdoubleD 315 Posting Shark

Ah gotcha, and one last real quick one before I dive into the insanity of my programming ways lol, when your saying class myOtherForm : Form the myOtherForm = the name of the other form(s) I want to be able to access that class.cs and Form = the class name (I.E. student).

I'm sorry if I sound dumb with this, I just like to make sure my details are clearly put before I dive into it head first and then cause a bunch of issue and look even stupider, thanks.

Exactly! Here is an example....

// STUDENT CLASS
    public class student
    {
        // storage/getter/setter property...
        public string Name { get; set; }

        public List<int> Scores = new List<int>();
        

        /* ...
         * your other code here I left out for brevity...
         * ...
         * */

        // average all test scores for class/school or whatever is in our list...
        public static int averageAllStudents(List<student> Students)
        {
            int totScores = 0; // operand is total of all scores for all students
            int totCount = 0;  // dividend is total count of all score entries for all students

            // for every student
            foreach (student s in Students)
            {
                // and for every student score
                foreach (int score in s.Scores)
                {
                    totScores += score; // add score
                    totCount++; // increment count
                }
            }
            return totScores / totCount; // return average
        }

        // completely optional...,but to demonstrate how to override ToString to return name
        public override string ToString()
        {
            return this.Name;
        }
    }

Then, …

ddanbe commented: Who said I was tenacious?? Great! :) +14
DdoubleD 315 Posting Shark

Ok make sense, 3 of my forms require me to pull the data from the student array (I.E. show current scores) and the allow the ability to add\delete them. I guess I'm confused that if I put the array in the main form that the other forms won't be able to access it? Again I might just be thinking too far down the road.

No, now would be the time to think about that, but that problem is solved when you pass the list into the form as I demonstrated using class MyOtherForm : Form as an example.

DdoubleD 315 Posting Shark

Even if you want to average all students' scores, you could put this functionality in the student class. For example public static int averageAllStudents(List<student> Students) :

class student
        {
            private string name;
            public string Name // getter/setter property...
            {
                get { return name; }
                set { name = value; }
            }
            private List<int> Scores = new List<int>();

            // your other code here I left out for brevity...

            // average all test scores for class/school or whatever is in our list...
            public static int averageAllStudents(List<student> Students)
            {
                int totScores = 0; // operand is total of all scores for all students
                int totCount = 0;  // dividend is total count of all score entries for all students

                // for every student
                foreach (student s in Students)
                {
                    // and for every student score
                    foreach (int score in s.Scores)
                    {
                        totScores += score; // add score
                        totCount++; // increment count
                    }
                }
                return totScores / totCount; // return average
            }

            // completely optional...,but to demonstrate how to override ToString to return name
            public override string ToString()
            {
                return this.name;
            }

        }
DdoubleD 315 Posting Shark
// your main form
        class MainForm : Form
        {
            List<student> Students = new List<student>();
 
            // Call one of my other forms....
            public void LoadNextForm()
            {
                MyOtherForm form2 = new MyOtherForm(Students); // pass the list to the form...
            }
        }
 
        // shows how your form can use an existing Students list....
        class MyOtherForm : Form
        {
            List<student> Students; // maintain a reference to same list for each form...
            ListView listView1 = new ListView();
 
            // pass the list into your constructor...
            public MyOtherForm(List<student> students)
            {
                this.Students = students; // set this form's reference to the list...
            }
 
            public void LoadListView()
            {
                foreach (student s in Students)
                {
                    // populate/add using ToString override...
                    listView1.Items.Add(s.ToString());
 
                    // or, using Property for student name...
                    //listView1.Items.Add(s.Name);
                }
            }
        }

Just to be sure I'm doing this correctly, I would create 2 other class files that inhert. the functionality of my main.cs? or do I code everything into my student.cs?
Thank you.

Well, just to be sure, you plan to create a separate class file for each form I imagine, using the designer too, right?

As far as main.cs is concerned, I would eliminate that altogether and put the declaration/instantiation of Students list in the whatever your main Form is.

Since you are storing all scores for a student with that student List entry, there is no need to have an additional wrapper class to hold additional details about an individual student.

DdoubleD 315 Posting Shark

I guess yeah, but I think later in my project because I have to with 5 different forms, and allow selection of students and all their scores\data is stored under the array per their name it would be more functional to make the method Array. Because I have to enter the students -> be able to add\update\delete scores per student.

I'll play around with it a bit, because I'm sure I'm going to confuse myself some more later on.

Nope, don't use Array because you just wind up boxing/unboxing the data. Stick to your strongly typed List<student> and just pass that into each form:

class student
        {
            private string name;
            public string Name // getter/setter property...
            {
                get { return name; }
                set { name = value; }
            }
            private List<int> Scores = new List<int>();

            // your other code here I left out for brevity...

            // completely optional...,but to demonstrate how to override ToString to return name
            public override string ToString()
            {
                return this.name;
            }
        }

        // your main form
        class MainForm : Form
        {
            List<student> Students = new List<student>();

            // Call one of my other forms....
            public void LoadNextForm()
            {
                MyOtherForm form2 = new MyOtherForm(Students); // pass the list to the form...
            }
        }

        // shows how your form can use an existing Students list....
        class MyOtherForm : Form
        {
            List<student> Students; // maintain a reference to same list for each form...
            ListView listView1 = new ListView();

            // pass the list into your constructor...
            public MyOtherForm(List<student> students)
            { …
DdoubleD 315 Posting Shark

See I might have it wrong, but I was figuring that the Array allStudents() would put the list of students in my list box? Again I might be wrong, so correct me if I am.

Not necessarily wrong. I was just curious. You could load the list box using the existing Students list.

DdoubleD 315 Posting Shark

What is the return value of public Array allStudents() to be used for? I'm trying to figure out why you decided on Array as the return type.

DdoubleD 315 Posting Shark

Incidentally, I ran across many blogs indicating you shouldn't create extensions using managed code. I was reading up on the subject somewhat before you indicated you had it solved. I was wondering whether you have considered these concerns and you are confident you won't have the issues they discuss?

DdoubleD 315 Posting Shark

Many of us don't have 64 bit systems, so I'm not surprised you didn't get input. Anyway, just wanted to say thanks for posting your solution because many just say they solved it themselves and that's it.

Cheers!

DdoubleD 315 Posting Shark

Tried your version Ryshad but I get an index out of range error when dataGridView1 RowsAdded event fires.

Set a breakpoint and the RowCount = 1 & RowIndex = 0

Any ideas

Tino

Sorry about reading right over the "Cell" color designator with this thread. Anyway, check your Cell's indexer because the RowIndex looks good...