Monday, August 8, 2022

Membuat Paginasi dengan Visual Basic .Net


Berikut adalah contoh Paginasi pada DataGridView dengan Visual Basic .Net


Buat tampilan seperti gambar diatas terdiri dari 2 Button, dengan nama masing-masing btnPrev, btnNext lalu 1 DataGridView

Setelah itu tambahkan sintak seperti dibawah ini :

Imports System.Data.SqlClient
Public Class Form1
Dim pagingAdapter As SqlDataAdapter
Dim pagingDS As DataSet
Dim scrollVal As Integer
Private Const dtbase As String

           dtbase = “data source=.;initial catalog=lp3i;integrated security=true”

Private Sub viewData()
Dim sql As String = “Select * From barang”
Dim connection As New SqlConnection(dtbase)
pagingAdapter = New SqlDataAdapter(sql, connection)
pagingDS = New DataSet()
connection.Open()
pagingAdapter.Fill(pagingDS, scrollVal, 10, “isiTabel”)
connection.Close()
DataGridView1.DataSource = pagingDS
DataGridView1.DataMember = “isiTabel”
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
viewData()
End Sub

Private Sub btnPrev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrev.Click
scrollVal = scrollVal – 10
If scrollVal <= 0 Then
scrollVal = 0
End If
pagingDS.Clear()
pagingAdapter.Fill(pagingDS, scrollVal, 10, “isiTabel”)
End Sub

Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
scrollVal = scrollVal + 10
If scrollVal > 23 Then
scrollVal = 28
End If
pagingDS.Clear()
pagingAdapter.Fill(pagingDS, scrollVal, 10, “isiTabel”)
End Sub
End Class

Jalankan tekan F5



Memunculkan Simbol & Emoji Pada OS Mac

  Memunculkan Simbol & Emoji  1. Buka aplikasi Pages / Notes pada Macbook. 2. Klik pada Menubar Edit --> Pilih Emoji and Symbols a...