本文整理汇总了VB.NET中System.Windows.Forms.BindingSource.Add方法的典型用法代码示例。如果您正苦于以下问题:VB.NET BindingSource.Add方法的具体用法?VB.NET BindingSource.Add怎么用?VB.NET BindingSource.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.BindingSource
的用法示例。
在下文中一共展示了BindingSource.Add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: PopulateBindingSourceWithFonts
Private WithEvents bindingSource1 As New BindingSource()
Private box1 As New TextBox()
Private Sub PopulateBindingSourceWithFonts()
bindingSource1.Add(New Font(FontFamily.Families(2), 8.0F))
bindingSource1.Add(New Font(FontFamily.Families(4), 9.0F))
bindingSource1.Add(New Font(FontFamily.Families(6), 10.0F))
bindingSource1.Add(New Font(FontFamily.Families(8), 11.0F))
bindingSource1.Add(New Font(FontFamily.Families(10), 12.0F))
Dim view1 As New DataGridView()
view1.DataSource = bindingSource1
view1.AutoGenerateColumns = True
view1.Dock = DockStyle.Top
Me.Controls.Add(view1)
box1.Dock = DockStyle.Bottom
box1.Text = "Sample Text"
Me.Controls.Add(box1)
view1.Columns("Name").DisplayIndex = 0
box1.DataBindings.Add("Text", bindingSource1, "Name")
End Sub
Sub bindingSource1_CurrentChanged(ByVal sender As Object, ByVal e As EventArgs) _
Handles bindingSource1.CurrentChanged
box1.Font = CType(bindingSource1.Current, Font)
End Sub