C# Populate DataGridView Using Multidimensional Array - Hallo sahabat Dev-Create, Pada Artikel yang anda baca kali ini dengan judul C# Populate DataGridView Using Multidimensional Array, kami telah mempersiapkan artikel ini dengan baik untuk anda baca dan ambil informasi didalamnya. mudah-mudahan isi postingan
Artikel array,
Artikel C#,
Artikel C# datagridview,
Artikel dataGridView,
Artikel Multidimensional Array,
Artikel Populate DataGridView From Multidimensional Array In C#, yang kami tulis ini dapat anda pahami. baiklah, selamat membaca.
Judul : C# Populate DataGridView Using Multidimensional Array
link : C# Populate DataGridView Using Multidimensional Array
Anda sekarang membaca artikel C# Populate DataGridView Using Multidimensional Array dengan alamat link https://dev-create.blogspot.com/2017/09/c-populate-datagridview-using.html
Judul : C# Populate DataGridView Using Multidimensional Array
link : C# Populate DataGridView Using Multidimensional Array
C# Populate DataGridView Using Multidimensional Array
How To Fill DataGridView From 2D Array Data Using C#
In This C# Tutorial We Will See How To Populate A DataGridView From A Multidimensional Array Content Using For Loop In CSharp Programming Language And Visual Studio Editor.
Project Source Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class _2DArray_To_DataGridView : Form
{
public _2DArray_To_DataGridView()
{
InitializeComponent();
}
private void _2DArray_To_DataGridView_Load(object sender, EventArgs e)
{
string[,] rows = new string[,]{ // 1 2 3 4
{"1","AAA","BBB","10"},//1
{"2","CCC","DDD","20"},//2
{"3","ZZZ","YYY","30"},//3
{"4","LLL","MMM","40"},
{"5","NNN","TTT","50"},
{"6","WWW","RRR","60"},
{"7","GGG","PPP","70"}//7
};
// rows.GetLength(0) return length of the first D (7)
// rows.GetLength(1) return length of the second D
for(int i = 0; i < rows.GetLength(0); i++)// array rows
{
string[] row = new string[rows.GetLength(1)];
for(int j = 0; j < rows.GetLength(1); j++)
{
row[j] = rows[i, j];
}
dataGridView1.Rows.Add(row);
}
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class _2DArray_To_DataGridView : Form
{
public _2DArray_To_DataGridView()
{
InitializeComponent();
}
private void _2DArray_To_DataGridView_Load(object sender, EventArgs e)
{
string[,] rows = new string[,]{ // 1 2 3 4
{"1","AAA","BBB","10"},//1
{"2","CCC","DDD","20"},//2
{"3","ZZZ","YYY","30"},//3
{"4","LLL","MMM","40"},
{"5","NNN","TTT","50"},
{"6","WWW","RRR","60"},
{"7","GGG","PPP","70"}//7
};
// rows.GetLength(0) return length of the first D (7)
// rows.GetLength(1) return length of the second D
for(int i = 0; i < rows.GetLength(0); i++)// array rows
{
string[] row = new string[rows.GetLength(1)];
for(int j = 0; j < rows.GetLength(1); j++)
{
row[j] = rows[i, j];
}
dataGridView1.Rows.Add(row);
}
}
}
}
// OUTPUT :
Demikianlah Artikel C# Populate DataGridView Using Multidimensional Array
Sekianlah artikel C# Populate DataGridView Using Multidimensional Array kali ini, mudah-mudahan bisa memberi manfaat untuk anda semua. baiklah, sampai jumpa di postingan artikel lainnya.
Anda sekarang membaca artikel C# Populate DataGridView Using Multidimensional Array dengan alamat link https://dev-create.blogspot.com/2017/09/c-populate-datagridview-using.html