Как заполнить 2D массив с помощью текстового поля в C#
Hello, I just started university and am currently learning to program. We've started learning about arrays and i've been a bit lost on how to implement this on a WinForm application. This is what I have so far but it does not work at all and i'm wondering if I could receive a bit of help on how to solve this issue. So basically I have a WinForm with a single button and a single textbox. I have a 2d array that is [3,5] and what I want to happen is have the user input a number in the textbox, click the button and that value would be stored at [0,0], the textbox would then clear, have the user input another number, and that would be saved in [0,1], etc. When the first row is filled it would then start saving on the next row [1,0] and so on. Thanks a lot for any help given.
Что я уже пробовал:
public partial class Form1 : Form { int[,] array2d = new int[3, 5]; int row = 0; int col = 0; public Form1() { InitializeComponent(); } private void btnArray_Click(object sender, EventArgs e) { for(row = 0; row < 3; row++) { for(col = 0; col < 5; col++) { array2d[row, col] = int.Parse(txtBoxArrays.Text); txtBoxArrays.Clear(); } } } }