The DataGridView control is designed to be a complete solution for displaying tabular data with Windows Forms. The DataGridView control is highly configurable and extensible, and it provides many properties, methods, and events to customize its appearance and behavior. The DataGridView control is used to display data from a variety of external data sources. Alternatively, you can add rows and columns to the control and manually populate it with data. The following vb.net source code shows how to manually create Columns and Rows in a DataGridView.
DataGridView1.Columns(Index).Name = "Column Name"
Imports System.Data.SqlClient
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
DataGridView1.ColumnCount = 3
DataGridView1.Columns(0).Name = "Product ID"
DataGridView1.Columns(1).Name = "Product Name"
DataGridView1.Columns(2).Name = "Product_Price"
Dim row As String() = New String() {"1", "Product 1", "1000"}
DataGridView1.Rows.Add(row)
row = New String() {"2", "Product 2", "2000"}
DataGridView1.Rows.Add(row)
row = New String() {"3", "Product 3", "3000"}
DataGridView1.Rows.Add(row)
row = New String() {"4", "Product 4", "4000"}
DataGridView1.Rows.Add(row)
End Sub
End Class
Diperuntukkan bagi mereka yang ingin belajar bahasa pemrograman VB.Net. Blog ini menyediakan referensi tentang segala sesuatu dari pemrograman dasar. Blog ini menyajikan konsep dasar VB.NET seperti konsep pemrograman OOP, penggunaan objek dan koleksi lainnya. Selain tempat untuk belajar juga merupakan tempat untuk berbagi Pengalaman, Pengetahuan, Pertukaran dan Pertanyaan yang diajukan.
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar