BindingNavigatorAddNewItem已禁用 [英] BindingNavigatorAddNewItem is disable
本文介绍了BindingNavigatorAddNewItem已禁用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只是想知道我的绑定导航器plus在我运行我的应用程序时被禁用了,请您帮忙,
这是我的课:
Hi,
I just wonder my binding navigator plus is disable when I run my application, I need your help guys, please,
Here is my class:
Interface DIc
Property meaning() As String
Property word() As String
End Interface
<serializable()> Public Class Class1
Private word As String
Private meaning As String
Public Sub New(ByVal cWord As String, ByVal cMeaning As String)
word = cWord
meaning = cMeaning
End Sub
Public Property pWord() As String
Get
Return Me.word
End Get
Set(ByVal value As String)
Me.word = value
End Set
End Property
Public Property pMeaning() As String
Get
Return Me.meaning
End Get
Set(ByVal value As String)
Me.meaning = value
End Set
End Property
Public ReadOnly Property Full() As String
Get
Return Me.word & " " & Me.meaning
End Get
End Property
End Class
这是我的表格代码
and this is my form code
Imports ClassLibrary1.Class1
Imports ClassLibrary1
Imports System.IO
Public Class Form1
Dim bf As New BinaryFormatter
Dim Ar As New ArrayList
Dim BS As New BindingSource
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Ar.Add(New Class1("A", "Apple"))
Ar.Add(New Class1("B", "Book"))
bs.DataSource = Ar
ComboBox1.DataSource = bs
ComboBox1.DisplayMember = "pWord"
TextBox2.DataBindings.Add("Text", bs, "pMeaning", True)
BindingNavigator1.BindingSource = bs
End Sub
End Class
推荐答案
如果不使用BindingSource,则需要显式设置BindingContext属性.正如名称"BindingNavigator"所暗示的,必须进行某种绑定.还要注意,BindingNavigator只是一个专门的ToolStrip.如果您不想使用绑定任何东西,那么只需使用所需的功能创建自己的ToolStrip.
这可能是造成您问题的根本原因.
If you don''t use a BindingSource then you''d need to set the BindingContext property explicitly. There has to be some sort of binding going on, as the name "BindingNavigator" suggests. Note also that the BindingNavigator is simply a specialised ToolStrip. If you don''t want to use bind anything then just create your own ToolStrip with the functionality you do want.
It might be the root cause for your problem.
这篇关于BindingNavigatorAddNewItem已禁用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文