Share 2 dimensional array in vb.net

phamphuong1210

New member
** 2 mảng chiều trong vb.net **

Một mảng 2 chiều trong vb.net là một tập hợp các phần tử được sắp xếp theo các hàng và cột.Mỗi phần tử trong mảng được truy cập bằng chỉ mục hàng và cột của nó.Mã sau đây tạo ra một mảng 2 chiều của các số nguyên:

`` `VBNet
Dim MyArray (10, 10) như số nguyên
`` `

Kích thước đầu tiên của mảng, 10, chỉ định số lượng hàng trong mảng.Kích thước thứ hai, 10, chỉ định số lượng cột trong mảng.

Để truy cập một phần tử trong mảng, bạn sử dụng cú pháp sau:

`` `VBNet
MyArray (Rowindex, Cột Index)
`` `

Ví dụ: mã sau truy cập phần tử trong hàng đầu tiên và cột đầu tiên của mảng:

`` `VBNet
MyArray (0, 0)
`` `

Bạn cũng có thể sử dụng cú pháp sau để truy cập một phần tử trong mảng:

`` `VBNet
MyArray (hàng, cột)
`` `

Ví dụ: mã sau truy cập phần tử trong hàng đầu tiên và cột đầu tiên của mảng:

`` `VBNet
MyArray (1, 2)
`` `

## 5 hashtags

* #2Darray
* #vb.net
* #mảng
* #Programming
* #tutorial
=======================================
**2 Dimensional Array in VB.NET**

A 2 dimensional array in VB.NET is a collection of elements that are arranged in rows and columns. Each element in the array is accessed using its row and column index. The following code creates a 2 dimensional array of integers:

```vbnet
Dim myArray(10, 10) As Integer
```

The first dimension of the array, 10, specifies the number of rows in the array. The second dimension, 10, specifies the number of columns in the array.

To access an element in the array, you use the following syntax:

```vbnet
myArray(rowIndex, columnIndex)
```

For example, the following code accesses the element in the first row and first column of the array:

```vbnet
myArray(0, 0)
```

You can also use the following syntax to access an element in the array:

```vbnet
myArray(row, column)
```

For example, the following code accesses the element in the first row and first column of the array:

```vbnet
myArray(1, 2)
```

## 5 Hashtags

* #2Darray
* #vb.net
* #Array
* #Programming
* #tutorial
 
Join Telegram ToolsKiemTrieuDoGroup
Back
Top