badiorew.blogg.se

Aplikasi vb net 2010 menggunakan ms access
Aplikasi vb net 2010 menggunakan ms access






aplikasi vb net 2010 menggunakan ms access

Private Sub btnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEdit.Clickĭim perintah As New Private Sub btnKeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKeluar.Click Konek("localhost", "root", "", "perkuliahandb")ĭtpTgl.Format = DateTimePickerFormat.Custom Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load MsgBox("Data gagal disimpan" + ex.Message, MsgBoxStyle.Critical) MsgBox("Data berhasil disimpan", MsgBoxStyle.Information, "Informasi") Perintah.CommandText = "INSERT INTO mahasiswa (nim, nama, jekel, tempat, tgl_lahir, alamat) VALUES ('" & txtNim.Text & "', '" & txtNama.Text & "', '" & cbJk.Text & "', '" & txtTempat.Text & "', '" & dtpTgl.Text & "', '" & txtAlamat.Text & "')" Private Sub btnSimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSimpan.Click TabelMhs.Columns(5).HeaderText = "ALAMAT" TabelMhs.Columns(4).HeaderText = "JENIS KELAMIN" TabelMhs.Columns(3).HeaderText = "TGL LAHIR" TabelMhs.Columns(2).HeaderText = "TEMPAT" TabelMhs.AutoSizeColumnsMode = DataGridViewAutoSizeColumnMode.Fill Initial Catalog=pubs Integrated Security=True" Dim sql As String = "SELECT title_id,title,type,pub_id FROM Titles" Dim connection As New SqlConnection(connectionString) Dim dataadapter As New SqlDataAdapter(sql, connection) connection.Open() dataadapter.Fill(ds, "Titles_table") connection.Close() DataGridView1.DataSource = ds.Tables(0) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim dv As DataView dv = New DataView(ds.Tables(0), "type = 'business' ", "type Desc", DataViewRowState.CurrentRows) DataGridView1.DataSource = dv End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click DataGridView1.Sort(DataGridView1.Columns(1), ListSortDirection.Dim conn As New MySqlConnection("Server=localhost user=root database=perkuliahandb")Īdapter = New MySqlDataAdapter(sqlstr, conn)

aplikasi vb net 2010 menggunakan ms access aplikasi vb net 2010 menggunakan ms access

Imports System.ComponentModelPublic Class Form1 Dim ds As New DataSet Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim connectionString As String = "Data Source=. In the above vb.net code, datagridview is filter the column Type and the column value is Business. You can sort data while fetching it from database using order by clause in SQL statement or you can use the following method.ĭv = New DataView(ds.Tables(0), "type = 'business' ", "type Desc", DataViewRowState.CurrentRows) You can use different methods to filter datagridview column. In the above vb.net code, datagridview sort the title column. You can sort the data in ascending or descending order based on the contents of the specified column of sort() method.ĭataGridView1.Sort(DataGridView1.Columns(1), ListSortDirection.Ascending) The DataGridView control in VB.Net provides automatic sorting, so that you can sort any column in the datagridview control.

#Aplikasi vb net 2010 menggunakan ms access how to#

The following vb.net program shows how to filter and sort a DataGridView by using a DataView Object. A DataView provides a means to filter and sort data within a DataTable. You can extend the DataGridView control in a number of ways to build custom behaviors into your applications. The DataGridView control provides a customizable table for displaying data.








Aplikasi vb net 2010 menggunakan ms access