Like this it will looks in Win Form:
- Giving value of N(Rows) and M(Columns)

- Clicking Create will automatically create fields in range and look like two dimensional array:

However the basic design is to create and arrange the textboxes to look typically like a two dimensional array.
The code that generates "Matrices" is the following:
Point merlokacionin = this.label.Location;// This take the location in form . We have added a label with no text just to take the location and under it to add fields.
int a = merlokacionin.X + 80;//The coordinate X of the label we give to the int variable a
int b = merlokacionin.Y;//The coordinate Y
if ((textBox1.Text == "") || (textBox2.Text == ""))
MessageBox.Show(" To create a Matrices you need to give up the numbers of columns and rows.,"opps",MessageBoxButtons.OK,MessageBoxIcon.Error);
else
{
n = Convert.ToInt32(textBox1.Text);// Take the value N -Rows
m = Convert.ToInt32(textBox2.Text);// Take the value M-Columns
}
int i, j;
int[,] Matrica;
Matrica = new int[n, m];//
for (i = 0; i < n; i++)
{
a = merlokacionin.X + 10; // fields will be at coordinate X // in 10
point at right from label1.
b = b + 30;// the coordinate of b is changed with adding in 30 points , so the //field will be added in 30 points under the label1.
for (j = 0; j < m; j++)
{
textbox[i, j] = new TextBox(); // it create the new //textbox field, the creating fields will continue while as we have the //columns and rows.
string emriTextBox = "A" + Convert.ToString(i);//We set the name for textbox
this.textbox[i, j].Name = emriTextBox; //give name to textbox
a = a + 25;// change the coordinate of X and every 25 points will be the next field
textbox[i, j].Width = 25;
textbox[i, j].Height = 25;
textbox[i, j].Location = new Point(a, b + 30);//Now the field take the location where it will be pasted.
this.Controls.Add(textbox[i, j]);
}
}
After this we can manipulate with matrices making it to find the minimum the maximum or sorting the matrices with bubble sort, select sort or any other operation with matrices and arrays. All this using values in Textboxes.
Elham HamitieditedPosted Feb 9, 2011, 6:13 PMEdited Feb 9, 2011, 6:21 PM
Those comments are in in Albanian, I will make in English and post again...Thank you!
robertPosted Feb 8, 2011, 7:27 AM
Thank you What language are these comments in? Could you put them in English? " int a = merlokacionin.X + 80;//boshti x por i kemi thene me nje zhvendosje pre 80 piksel qe te kemi nje dizajn me te mire, nuk eshte e thene te jete keshtu gjithmon kjo mund te ndryshoj int b = merlokacionin.Y;//boshti i y "