DdoubleD 315 Posting Shark

Here are some changes I made based on the way you are using your list. NOTE: I didn't compile, but I believe is OK:

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

namespace TESTpractice
{
    class Program
    {
        static void Main(string[] args)
        {
            Program t = new Program();
            t.Run();
        }
        public void Run()
        {
            Insect insects = new Insect(8, 8, "Ugly Spider", "Arachnida"); // if need to use contsructor
            insects.Add (8, 8, "Black Widow", "Arachnida"); // add method
            insects.Add (8, 8, "Brown Spider", "Arachnida");

            insects.getInfoAll(); // print out entire list
        }
    }
    public class Insect
    {
        public List<Insect> insects = new List<Insect>();
        public int Eyes { get; set; }
        public int Legs { get; set; }
        public string Species { get; set; }
        public string Family { get; set; }

        public Insect()
        {
        }
        public Insect(int myEyes, int myLegs, string mySpecies, string myFamily)
        {
            Add(myEyes, myLegs, mySpecies, myFamily);
        }
        public void Add (int myEyes, int myLegs, string mySpecies, string myFamily)
        {
            Eyes = myEyes;
            Legs = myLegs;
            Species = mySpecies;
            Family = myFamily;
            insects.Add(this);
        }

        public void getInfo()
        {
            Console.WriteLine(" Species: {0} \n Family: {1} \n Number of eyes: {2}\n Number of legs: {3}",
            Species, Family, Eyes.ToString(), Legs.ToString());
        }

        public void getInfoAll()
        {
            foreach (Insect insect in insects)
            {
                insect.getInfo();
            }
        }
    }
}
DdoubleD 315 Posting Shark

Put it inside your Insect class.

DdoubleD 315 Posting Shark

I cant seem to edit my post... but I'm having a bit of trouble trying to loop through the objects.

So in my insect class I have List<Insect> but I want to some how display all the objects in my Main section. I have a method in insect class that displays the info of the insect.
for example. spider.GetInfo would tell me all about the insect. But I want the method to be able to be called in a foreach loop, display all the details about all the insects. This would require a static method, (so i could call just Insect.GetInfo()) but i have variables in my methods, so that won't work... any help?

I don't which one you used since you didn't post the code. Here is an example:

foreach (Insect insect in insects)//where insects is your list
    insect.GetInfo();

If that answers your questions, please mark as SOLVED. Otherwise, just ask another question.-- Cheers!

DdoubleD 315 Posting Shark

I still don't understand, but to search an entire drive for a file is not difficult to do:

DirectoryInfo di = new DirectoryInfo(@"c:\");
            FileInfo[] finfos = di.GetFiles("*.exe", SearchOption.AllDirectories);
            foreach (FileInfo fi in finfos)
                ; // do something with the file info
DdoubleD 315 Posting Shark

if you include List in your Insect class, you would just call the Add(T) method to add it:

public class Insect
    {
        List<Insect> insects = new List<Insect>();
        int legs, eyes;
        string species, family;

        public Insect(int legs, int eyes, string species, string family)
        {
            this.legs = legs;
            //....and so on  
            insects.Add(this);
        }
    }

If you inherit the List, then you could do this:

public class Insect : List<Insect>
    {
        //List<Insect> insects = new List<Insect>();
        int legs, eyes;
        string species, family;

        public Insect(int legs, int eyes, string species, string family)
        {
            this.legs = legs;
            //....and so on  
            Add(this); //insects.Add(this);
        }
    }
DdoubleD 315 Posting Shark

And Extension methods brought to you by framework 3.x! :)

I had to +rep you for this example, which was my first exposure to usage of Extension Methods. The fist thing I did of course was drop the code into another class, which produced an error and forced me to read up on the subject a little. ;)

DdoubleD 315 Posting Shark

Why would you want your application to delete itself?

DdoubleD 315 Posting Shark

hello=) i think it run withins the form?
but how do i make it so like:

when i click BTNOK it will run the program which will a check if any textbox or any combo boxes[selecteditem] have change as compare to the data store. then it will run save program.

so it's like doing a check when BTN OK is click.

I wrote this for your button cancel, but you can apply this logic anywhere in your program:

private void btnCancel_Click(object sender, EventArgs e)
        {
            bool bEditChange = false;
            
            if ("whatever was read from text file" != (string)comboBox1.SelectedItem)
                bEditChange = true;

            if ("whatever was read from text file" != textBox1.Text)
                bEditChange = true;

            // etc.,etc.,etc.

            if (bEditChange)
            {
                if (DialogResult.Yes == MessageBox.Show("Save Changes?", "Cancel", MessageBoxButtons.YesNo))
                {
                    // do your file save stuff
                }
            }
        }
DdoubleD 315 Posting Shark

This is what the event wiring for combobox selection change should look like in case you don't use VS designer:

// in form intialization:
            this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);

// then, just create this method for your form:
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            // to retrieve it's index:
            int index = comboBox1.SelectedIndex;
            /// if your item is text, otherwise cast to proper type:
            string text = (string)comboBox1.SelectedItem;
        }
DdoubleD 315 Posting Shark

In your set statement, you create a new var of name "_Imge"--was that intended? And, you also call the property setter again with Imge = value --was that intended?

Maybe I've missed something, but I don't understand why you would return _Imge in your getter, but then call the setter again inside the set property, or why you would create, or attempt, what appears to be another instance for _Imge in the setter (and then not even use it).

DdoubleD 315 Posting Shark

thanks worked great. I think it also had something to do with how i was trying to change the image size of each image.

Is there a way to set a different ImageSize for every image?

The ImageList.ImageSize property pertains to all images in the list and I don't believe you can individually set each image's size.

DdoubleD 315 Posting Shark

I know this is a kind of broad question, but I have been having a hard time in general knowing when to put what call parameters into what functions. Does anybody have any good tips on when to know when to use a void function verses a bool or int or other type of function. Also how to know what to call into the Function?

Well, you bring up to different topics really when mention both parameters and the "void function verses....", which would indicate return type.

Return type really depends on what you want. If it makes sense that your function should return an integer, then you would make it an int myFunc() declaration.

Parameters also depend on type, but if you pass by address/reference, then they can also return a changed value via the parameter...hmmmm...

So, when should I use a parameter verses a return value...hmmm...

Well, when you pass in a parameter, you might expect the contents of a parameter to be modified, or even allocated and then assigned. However, you can do the same thing with the return value of a function....hmmmm...

I think it just boils down to user preference and adhering to coding practices already in place for consistency--for the most part. But, you really can achieve similar/same results doing it either way except that you can only return one item, but you can pass several as parameters....

At this point, I will let someone else take over …

DdoubleD 315 Posting Shark

I trust you will know what to do with this:

DateTime arrival = new DateTime();
            DateTime departure = new DateTime();
            TimeSpan ts = arrival - departure;
            if (ts.Days > 5 * 365)
                MessageBox.Show("Houston, we have a problem....");
DdoubleD 315 Posting Shark

I'm confused a little. I understand if you cannot use the date picker control... Can you explain with a briefer section of code that shows exactly what you are trying to but cannot achieve?

DdoubleD 315 Posting Shark

It's based on C, so I believe the answer is absolutely and the same.... perhaps someone will have more to add to this...

DdoubleD 315 Posting Shark

Well..yeah.. wasent sure if he ment 5 years ahead of today or 5 years before today! I assumed its checking the date to be withing 5 years ahead of today.

Second set of eyes never hurts--LOL. I went to back to see if I had the comparison operator correct--I was going to blame it on Michelob Brewing Co if not. ;)

Cheers!

DdoubleD 315 Posting Shark

simply use the 'Value Changed' event of the DateTimePicker control.

if (dateTimePicker1.Value > DateTime.Now.AddYears(5))
        MessageBox.Show("Date should be within the next 5 years");

I think it was meant to say < -5 given you want to see if the date is 5 years older than current:

if (dateTimePicker1.Value < DateTime.Now.AddYears(-5))
DdoubleD 315 Posting Shark

Im trying to create a listview showing images with text

so how exactly can i do this? (im using visual studio if it helps)

Heres the code that isn't working now

// adding images ...
        imageList1.Images.Add("Unique key", Image.FromFile("..."));
        listView1.Items.Add("text for image", "Unique key");
        /*
         * more
         * images
         * 
         * */
        listView1.LargeImageList = imageList1;

i also tried inserting listView1.LargeImageList = imageList1; before adding the images.

how can make this listview show images with text the way i want?

I ran a test using your code and no image was drawn as you said. Then, I setup the ListView control to contain the imageList I added to the form and it appeared fine. I am guessing that the imagekey attempts to be associated at the time the new item is added listView1.Items.Add("text for image", "Unique key"); . Try associating the imageList first before you add the new item: listView1.LargeImageList = imageList1; , then add item...

DdoubleD 315 Posting Shark

Because it is a defined class type and not an instance type.

DdoubleD 315 Posting Shark

I don't see any difference except I crammed it all in one header file. I am using VS2008 compiler. Here is the header code I have:

#ifndef POINT3D_H
#define POINT3D_H
 
#ifndef POINT_H
#define POINT_H
 
#include <iostream>
 
template <typename T>
class Point
{
protected:
	T X,Y,Z;
public:
 
	Point(const T x, const T y, const T z) : X(x), Y(y), Z(z) {}
 
	T getX() {return X;};
	T getY() {return Y;};
	T getZ() {return Z;};
 
	void Output();
 
};
 
template< typename T>
void Point<T>::Output()
{ 
	std::cout << "x: " << X << " y: " << Y << " z: " << Z << std::endl;
}
 
#endif
//////////////////////

//////////////////////
template <typename T>
class Point3D : public Point<T>
{
	//T X,Y,Z;
	public:
		Point3D(const T x, const T y, const T z) : Point<T>(x,y,z) {}
 
		void Output3D();
};
 
template< typename T>
void Point3D<T>::Output3D()
{
	std::cout << "3D" << std::endl;
 
	//these both show junk values
	std::cout << "X: " << this->X << std::endl;
	std::cout << "X: " << X << std::endl;
 
	//this says "there are no arguments to 'getX' that depend on a template parameter, so a declaration of 'getX' must be available
	double x = getX();
	std::cout << "X: " << x << std::endl;
}
 
#endif
daviddoria commented: thanks for the response! +5
DdoubleD 315 Posting Shark

I uncommented those two lines after commenting out the unnecessary var declarations, and I run just fine. Did you change something else?

DdoubleD 315 Posting Shark

The junk values are because you declare in both Point and Point3D:

T X,Y,Z;

but, you only initialize those belonging to Point in the construction.

As far as it running as posted, I had no problems running it and the data appeared correctly as coded to me, but maybe it's because you commented out the problems?

DdoubleD 315 Posting Shark

x functions is this :

monthlyWorks(infoTB.Text, thisMounth);

public DataSet monthlyWorks(string IsyeriId, string month)
        {
            Service();
            string str;
            str = string.Format("SELECT Kartno,IsyeriId,Tarih,Tutar,IslemTipi,KazandirilanPuan,HarcattirilanPuan FROM IslemTablosu WHERE IsyeriId='{0}' and MONTH(Tarih)='{1}' ", IsyeriId, ay);
            SqlDataAdapter adapter = new SqlDataAdapter(str, connection);
            DataSet dataset = new DataSet();
            adapter.Fill(dataset);
            return dataset;
        }

y function is also same but it does not get IsyeriId, it gets CardNo...

My problem is form1 sends IsyeriId to form3 whenever push a Islem button in form1. form2 sends CardNo to form3 whenever push a Islem button in form2.

I'm not sure I understand the problem as stated. I see you are trying to communicate between forms, but what exactly is not working?

DdoubleD 315 Posting Shark

I have two form.

Form 1 and Form 2

In form 1, i have a few textbox and and combo box. and BTNOk [to save] and BTNCancel[when BTNCancel is click, user are prompt whether to save file if there is changes in entry]

Form 2 is the file where BTNCancel is clicked.
Display:
Do you want to save changes to your setting?
BTNYES,BTNNO, BTNCANCEL.

QUESTION

When I clicked BTNYES in form 2 how can I call BTNOK in form 1 so that it can run the event handler in form 1 BTNOK

another question. any idea of how to do password encryption/decryption

Try this, and create a new thread for question about password encryption/decryption.

// in form1 where calling form2
            Form form2 = new Form();
            DialogResult result = form2.ShowDialog();
            if (result == DialogResult.OK) // or whatever result you want to return
            {
                //call your handler to save or whatever
            }

            // inside form2's button handler:
            this.DialogResult = DialogResult.OK; // will be returned from form2.ShowDialog()
DdoubleD 315 Posting Shark

Have you tried Form.Activate ?

DdoubleD 315 Posting Shark

Well, I don't know what a vehicle intialization code is, but it is probably something that both automobile (car) and truck have, and something that definitely belongs in a base like vehicle and you probably don't need it defined in auto. However, you can override methods to provide different information depending on the usage....

DdoubleD 315 Posting Shark

That will work, but I was hoping for something a bit cleaner. Like being able to call the constructor from the Vehicle class directly somehow

Gosh, now that I've been programming in C# for a little while, I want to ask why, but I remember wanting to do something similar some time ago....elaborate why you want to do this.

DdoubleD 315 Posting Shark

Post the new code with your changes and I will see what you've done.

DdoubleD 315 Posting Shark

Put the common methods in the vehicle class that are common to both truck and auto (car?).

Also, just FYI, you named class Automobile with constructor auto...

DdoubleD 315 Posting Shark

You need something like this:

///////
// ORIGINAL CODE
///////
node *start_ptr = NULL;
node *temp;
temp = new node;
 
fin.open ("tfile.data");
while (fin >> temp -> name)
{
  fin >> temp -> age;
  fin >> temp -> height;
  temp -> nxt = NULL;
}
 
if (start_ptr == NULL)
    start_ptr = temp;
while (temp != NULL)

//////////
// CHANGE TO SOMETHING LIKE:
/////////
node *temp;
node *start_ptr = temp = null;

string s; // you may want to use a char[] instead

fin.open ("tfile.data");
while (fin >> s)
{
  if (temp == null)
  {
    start_ptr = temp = new node();
  }
  else
  {
    temp = temp->nxt = new node();
  }
  temp->name = s; // won't work like this with a string: FYI
  fin >> temp -> age;
  fin >> temp -> height;
}

temp = start_ptr; 
while (temp != NULL)
   ....

I wrote that on the fly, but I think it is correct logic for using your definition. You will not be able to compile this, because I used a string and simplified it including leaving out a string copy you need to get the string into your char[]. I think if you look at this though, you will see what you are doing wrong in your original code.

Cheers.

DdoubleD 315 Posting Shark

Because you allocate only one node and you continue to overwrite it in each of your reads in your while loop. Therefore, when you set the start_ptr to the node, following the read loop, you are setting it to the end, which is actually (also) the beginning of your linked list because you have only one node in your linked list.

DdoubleD 315 Posting Shark

Don't know what "print them in CM " is. Take into account that dpi(dots per inch) on the screen almost always differs from the dpi on a printer.

I think he/she is referring to centimeters, but I suppose it could mean color monitor. AcronymFinder.com didn't have either of those for CM in InfoTech related definitions (26 possibilities), so I wanted to see what someone else would say--;).

DdoubleD 315 Posting Shark

Ooooh... Try this:

// In class Cell:
            public static CellState NextCellState(Cell cell)
            {
                if (cell.DefaultCell == CellState.SPACE)
                    return CellState.DOT;
                else if (cell.DefaultCell == CellState.DOT)
                    return CellState.PLUS;
                else if (cell.DefaultCell == CellState.PLUS)
                    return CellState.HASH;
                else
                    return CellState.SPACE;
            }

// then in operation1 method; you might need to rearrange
            public void operation1()
            {
                // NOTE: if you only need to evaluate from left to right one time,
                // then you can omit this loop. Otherwise, this loop will continue
                // changing the cell states until the conditions are not longer true.
                    for (int i = 0; i < ARRAYSIZE; i++)
                    {
                        bool bHasChanged = true;
                        while (bHasChanged)
                        {
                            bHasChanged = false;


                            // ** check next cell
                            if (i < ARRAYSIZE - 1 && Cell.NextCellState(Cells[i]) == Cells[i + 1].DefaultCell)
                            {
                                Cells[i].ChangeState();
                                bHasChanged = true;
                            }
                            // ** check previous cell
                            else if (i > 0 && Cell.NextCellState(Cells[i]) == Cells[i - 1].DefaultCell)
                            {
                                Cells[i].ChangeState();
                                bHasChanged = true;
                            }

                        }
                }
#if false
                // NOTE: if you only need to evaluate from left to right one time,
                // then you can omit this loop. Otherwise, this loop will continue
                // changing the cell states until the conditions are not longer true.
                bool bHasChanged = true;
                while (bHasChanged)
                {
                    bHasChanged = false;

                    for (int i = 0; i < ARRAYSIZE; i++)
                    {
                        // ** check previous cell
                        if (i > 0 && Cell.NextCellState(Cells[i]) == Cells[i - 1].DefaultCell)
                        {
                            Cells[i].ChangeState();
                            //bHasChanged = true;
                        }
                        
                        // ** check next cell
                        if (i < ARRAYSIZE - 1 && …
DdoubleD 315 Posting Shark

lets change the space to "_"
so --> "_" "." "+" "#" (this is the order)
i will make another example

input: ##+._+_#.#+.#
output will be: ###+.+_ _.##+#

each cell is compared to the left and right of the original cell (the input)
Now, there is no mistake in it.

This doesn't make sense to me, because you said:

This is the rules, if either one of the neighbouring cells has a state equal to the next state of the cell, then the cell is changed to the next state.

but, the input, and the output you say it should be both begins with "##", which is equal to the next state--is it not? How can your output be correct?

DdoubleD 315 Posting Shark

Here is an even shorter way to begin clarifying what I don't seem to understand. Sorry about changing the second cells earlier--the coffee speeds up my typing, but apparently not my brain so much.;)

INPUT: "##" AND "__" AND ".."
OUTPUT: "_#" AND "._" AND "+."

Right?

DdoubleD 315 Posting Shark

INPUT: "####"
OUTPUT: "#_#_"

INPUT: "++++"
OUTPUT: "+#+#"

Sorry, I meant:

INPUT: "####"
OUTPUT: "_#_#"

INPUT: "++++"
OUTPUT: "#+#+"

DdoubleD 315 Posting Shark

I am not sure why this reply got posted twice, but see my other comment on it. Also, here are two short examples I would like you to explain if the output is wrong (use underscore for space):

INPUT: "####"
OUTPUT: "#_#_"

INPUT: "++++"
OUTPUT: "+#+#"

thanks for the reply..

i am not quite sure about what you mean.
but i can give more explanation and example.

Yes, i only need to change changeState at cell .
the rule goes through each cell from left to right.
If the rule is not applied to the cell, then the cell remains unchanged.

this is the example (i won't use the "space" (ignore the space) because it is hard to see in here, so let say we have 3 state, ".", "+", "#" --> "#" will go to "." as the next state)

example 13 cells in a row:
the first row: ##+#++#..#+.#
the result: ######. ... #+.

sorry if it is not clear

DdoubleD 315 Posting Shark

example 13 cells in a row:
the first row: ##+#++#..#+.#
the result: ######. ... #+.

OK, now I'm confused, so let's just stick to the input/output. Let's use underscore for the space character. In the above, I would expect for output to be: "#_+#+##.+#+.#". I don't understand how you started the output with "###", because I would think you be changing the second cell to be "_" or space given your ChangeState() method and that it is equal to the adjacent cell's "#". Where am I confused?

DdoubleD 315 Posting Shark

What I'm trying to say is that if you are only allowed to change each cell once, and the completed array must not have any adjacent cells contain the same value, and, you must change the left hand cell side of the comparison (reading left to right), then let me know that all of these rules are true and I will show you what to do. I just don't want to begin without knowing the exact requirements.

Oh... here is what I mean:

for (int i = 0; i < ARRAYSIZE-1; i++)
                {
                    if (Cells[i].DefaultCell == Cells[i + 1].DefaultCell)
                    {
                        do
                        {
                            Cells[i].ChangeState();
                        }
                        while (i > 0 && Cells[i].DefaultCell == Cells[i - 1].DefaultCell);
                        System.Diagnostics.Debug.Assert(Cells[i].DefaultCell != Cells[i + 1].DefaultCell);
                    }
                }
DdoubleD 315 Posting Shark

What I'm trying to say is that if you are only allowed to change each cell once, and the completed array must not have any adjacent cells contain the same value, and, you must change the left hand cell side of the comparison (reading left to right), then let me know that all of these rules are true and I will show you what to do. I just don't want to begin without knowing the exact requirements.

DdoubleD 315 Posting Shark

thanks for the reply.
But i already check, it is not the answer.

the problem is i need to change the cell state(that i want to compare) to the next state first.
after that compare it to the left and right, if either one of it is the same, then the current cell will be changed too..

012345
#. +

here it is..
cell 2 is "space", and the next state is "."
cell 1 state is ".", so it has the same state with the next state of cell 2.
So cell 2 will be changed to "."

i still don't know how to assuming that the cell is changing state first before i compare it to the neighbouring cells.


thanks.

Yep, just noticed that after rereading and was about to tell you what to do. Also, you can remove that unnecessary line that compares the cell to itself because I forgot too.

When comparing those two cells (left cell and right cell), if you change the left cell instead of the right, you have the possibility of still having same adjacent cell values, which I was not sure if was allowed scenario. If that is OK, then you need only change ChangeState at cell. If remaining same adjacent cells must be done, you will need a nested loop, or additional logic to compare three cells at a time.

DdoubleD 315 Posting Shark
string[] ar = listBox1.SelectedItems.Cast<string>().ToArray<string>();

Wanted to +rep you, but I guess I already did somewhere and it wouldn't let me. Anyway, that is a very clean line of code I haven't seen before--kudos! I hope I remember it the next time I do that.;)

serkan sendur commented: chic +8
kvprajapati commented: Thanks! +15
DdoubleD 315 Posting Shark

I think this is what you want, but you need to compare your random generated cells to see if you are getting the ChangeState on the proper cell because I modified the index on that too.

public void operation1()
            {
                for (int i = 0; i < ARRAYSIZE-1; i++)
                {
                    if (Cells[i].DefaultCell == Cells[i + 1].DefaultCell && 
                        Cells[i].DefaultCell == Cells[i].DefaultCell)
                    {
                        Cells[i + 1].ChangeState();
                    }
                } 
                PrintCell();

            }
DdoubleD 315 Posting Shark

Hi,
In my current project,
Am drawing a set of boxes, all at run time, and inside them i have called few bitmap images for each box, this also happens at run time.
now i need to click that image, the image should be selected and that image shud appear as if the pixels are inversed.
HOw do i create a button click event for that image which is been called at run time..?

Plz help me out with this...

thanks in advance...

If you are creating a control (like PictureBox ) for each of the set of boxes, then you could create one click event that is wired to each of the controls at runtime:

void HandleMyBoxes_Click(object sender, EventArgs e)
        {
            PictureBox pb = sender as PictureBox;

            // .... Code to Invert the pb.Image
        }

        void CreateBox(Point pt)
        {
            PictureBox pb = new PictureBox();
            
            //.... Code to Add your bitmap object and position your control

            // Add click Event at runtime
            pb.Click += new System.EventHandler(HandleMyBoxes_Click);
        }
DdoubleD 315 Posting Shark

What is the definition of object Cell ?

Inside method operation1() :
1) You hardcoded 19 in your loop when you should use ARRAYSIZE-1 2) Where is the beginning of the else if clause?
3) Since you already have a method to change the state ChangeState() , what exactly is the purpose of operation1() method?

Also, try using the "preview" button when posting so you can see if your code tags are correct.;)

DdoubleD 315 Posting Shark

I was just trying to make my client's dream become true.
But i handled it in a different way.Thanks DoubleD.:)

Do you mind if I ask the situation and how you handled it?

DdoubleD 315 Posting Shark

Is step1 in adding parameter to the crystal report is:-
in .rpt file :-field explorer -->parameter field-->new ?.
I mean is that a mandatory step?.

I don't know whether you can programattically add new parameter fields to a report without running into undefined/bad behavior. My question is, why would you want to add parameter fields dynamically? How can the report itself benefit from a field that otherwise is not referenced by the report?

And don't worry about "stupid questions"--I ask them all the time..;)

DdoubleD 315 Posting Shark

What is the Specified argument was out of the range of valid values?.I don't get it.

The argument out of range exception is saying you are attempting to access an element outside of the allocated array size:

ParameterField parameterField = parameterFields[PARAMETER_FIELD_NAME];------  here i get the exeption

The definition PARAMETER_FIELD_NAME is a value that is larger/outside than the parameterFields.Count() - 1 element, which is the last possible element available.

DdoubleD 315 Posting Shark

Sure, if that is what you really want to do:

public Form2(Control [] controls) {}
//or
    public Form2(Button btn1, Button btn2, Button btn3)// etc.
    {}

or, you could even pass in reference to other form if the called form will know the controls and they are accessible:

public Form2(Form form1) {}
Diamonddrake commented: That's how I would have done it! +3
ddanbe commented: Passing a Form to a Form, nice! +12
DdoubleD 315 Posting Shark

Sure, if that is what you really want to do:

public Form2(Control [] controls) {}
//or
    public Form2(Button btn1, Button btn2, Button btn3)// etc.
    {}