0% found this document useful (0 votes)
68 views3 pages

Source Bt2

The document describes a class that loads student and class data from datasets into a form. It binds the datasets to controls like textboxes and dropdowns. Methods are included to navigate between student records by changing the binding manager's position and rebinding the controls. When the class dropdown changes, it filters the student data by class.

Uploaded by

henrythom
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views3 pages

Source Bt2

The document describes a class that loads student and class data from datasets into a form. It binds the datasets to controls like textboxes and dropdowns. Methods are included to navigate between student records by changing the binding manager's position and rebinding the controls. When the class dropdown changes, it filters the student data by class.

Uploaded by

henrythom
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Public Class bt2

‘khai bao
Dim obj As New clsaccess
Dim flage As Boolean = False
Dim dssv As New DataSet
Dim dslop As New DataSet
Dim dv_svlop As New DataView
Dim mbm As BindingManagerBase
‘nap du lieu len form
Private Sub bt2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dssv = obj.GetDatasetSV
dslop = obj.GetDatasetLop
'nap du lieu cho combox
With cboLop
.DataSource = dslop.Tables(0)
.DisplayMember = "tenLop"
.ValueMember = "MaLop"
End With
' nap du lieu cho luoi
dgrSinhVien.DataSource = dssv.Tables(0)

mbm = Me.BindingContext(dssv.Tables(0))
Display_TextBox(dssv)
End Sub

Sub Display_TextBox(ByVal ds As DataSet)


txtMaSV.DataBindings.Clear()
txtTen.DataBindings.Clear()
txtDiaChi.DataBindings.Clear()
dtpNgaySinh.DataBindings.Clear()
cboLop.DataBindings.Clear()
txtDienthoai.DataBindings.Clear()
chkSex.DataBindings.Clear()

txtMaSV.DataBindings.Add("text", ds.Tables("Sinhvien"), "MaSV")


txtTen.DataBindings.Add("text", ds.Tables("Sinhvien"), "tensv")
txtDiaChi.DataBindings.Add("text", ds.Tables("Sinhvien"), "diachi")
txtDienthoai.DataBindings.Add("text", ds.Tables("Sinhvien"), "dienthoai")
dtpNgaySinh.DataBindings.Add("text", ds.Tables("Sinhvien"), "Ngaysinh")
cboLop.DataBindings.Add("text", ds.Tables("Sinhvien"), "malop")
chkSex.DataBindings.Add("text", ds.Tables("Sinhvien"), "phai")

Lblvitri.Text = "Hien tai " & CStr(mbm.Position + 1) & "/" & mbm.Count
dgrSinhVien.DataSource = dssv.Tables(0)
End Sub

Private Sub bntdau_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles


bntdau.Click
mbm.Position = 0
Display_TextBox(dssv)
End Sub

Private Sub bnttruoc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles


bnttruoc.Click
If (mbm.Position > 0) Then
mbm.Position -= 1
Else
mbm.Position = mbm.Count - 1
End If
Display_TextBox(dssv)
End Sub

Private Sub bntsau_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles


bntsau.Click
If (mbm.Position >= mbm.Count - 1) Then
mbm.Position = 0
Else
mbm.Position += 1
End If
Display_TextBox(dssv)
End Sub

Private Sub bntcuoi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles


bntcuoi.Click
mbm.Position = mbm.Count - 1
Display_TextBox(dssv)
End Sub

Private Sub cboLop_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles cboLop.SelectedIndexChanged
Dim dt As DataTable

dt = obj.GetDatasetSV_Lop(cboLop.SelectedValue.ToString())
dv_svlop = dt.DefaultView
dgrSinhVien.DataSource = dv_svlop
End Sub
End Class

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy