在项目中使用BriskDataGrid

 

在项目中使用BriskDataGrid


首先必须建立一个Windows应用程序TestBriskDataGrid


要在这个项目里使用BriskDataGrid控件必须先在项目里添加引用。做法如下:


在工具箱单击“我的用户控件”

在面板上右击,在选择“添加/移除项...”

在“自定义工具箱”对话框的.NET Framework组件单击“浏览...”按钮

选择General.Control.WinForm.dll文件

只勾选BriskDataGrid,把其他两个的对勾去掉

单击“确定”按钮


这时在我的用户控件里BriskDataGrid控件。


briskDataGrid添加到窗体上,做法和其它控件一样。


接下来要填充数据集,如下:


Imports System

Imports System.Data

Imports System.Data.OleDb


Public Class Form1

Inherits System.Windows.Forms.Form


#Region " Windows ´°ÌåÉè¼ÆÆ÷Éú³ÉµÄ´úÂë "


Public Sub New()

MyBase.New()


InitializeComponent()


End Sub

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

If disposing Then

If Not (components Is Nothing) Then

components.Dispose()

End If

End If

MyBase.Dispose(disposing)

End Sub


Private components As System.ComponentModel.IContainer


Friend WithEvents BriskDataGrid As General.Control.WinForm.BriskDataGrid

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

Me.BriskDataGrid = New General.Control.WinForm.BriskDataGrid

Me.SuspendLayout()

'

'BriskDataGrid

'

Me.BriskDataGrid.Dock = System.Windows.Forms.DockStyle.Top

Me.BriskDataGrid.Location = New System.Drawing.Point(0, 0)

Me.BriskDataGrid.Name = "BriskDataGrid"

Me.BriskDataGrid.Size = New System.Drawing.Size(292, 232)

Me.BriskDataGrid.TabIndex = 0

'

'Form1

'

Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)

Me.ClientSize = New System.Drawing.Size(292, 266)

Me.Controls.Add(Me.BriskDataGrid)

Me.Name = "Form1"

Me.Text = "Form1"

Me.ResumeLayout(False)


End Sub


#End Region


Private conn As OleDbConnection

Private dsHR As DataSet

Private adptEmployee As OleDbDataAdapter

Private adptDepartment As OleDbDataAdapter


Private Sub FillDataSet()

Dim strConn As String

strConn = "Provider = Microsoft.Jet.OLEDB.4.0;"

strConn &= "Data Source = ../hr.mdb"


Me.conn = New OleDbConnection(strConn)


Me.dsHR = New DataSet


Me.adptEmployee = New OleDbDataAdapter("SELECT * FROM employees", Me.conn)

Me.adptDepartment = New OleDbDataAdapter("SELECT * FROM departments", Me.conn)


Me.adptDepartment.Fill(Me.dsHR, "departments")

Me.adptEmployee.Fill(Me.dsHR, "employees")

End Sub


Private Sub InitBriskDataGrid()

Dim dvEmployee As New DataView(Me.dsHR.Tables("employees"))

Me.BriskDataGrid.SetDataBinding(dvEmployee)

End Sub


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

Me.FillDataSet()

Me.InitBriskDataGrid()

End Sub

End Class


运行程序,表employees的数据就显示在数据BriskDataGrid里了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值