插入带有一些默认值的空白记录

时间:2013-10-04 16:31:09

标签: vb.net visual-studio-2010 visual-studio

我是visual basic的新手,并试图为家具公司制作数据库应用程序。我想添加一个默认值的记录,但我无法运行新项目按钮的代码。它表现得好像我没有输入任何代码。我正在使用Visual Studio 2012。

Private Sub BindingNavigatorAddNewItem_Click(sender As Object, e As EventArgs) Handles BindingNavigatorAddNewItem.Click

    GondereninAdiSoyadiTextBox.Text = "Some text"
    GondereninAdresiTextBox.Text = "Some text"
    GondereninVergiNoTextBox.Text = "Some text"
    Label1.Visible = False

    Me.Refresh()

End Sub

如何为BindingNavigatorAddNewItem添加代码?

1 个答案:

答案 0 :(得分:0)

无论如何,我用这段代码创建了另一个按钮:

Private Sub ToolStripButton2_Click(sender As Object, e As EventArgs) Handles ToolStripButton2.Click

    MakbuzTBindingSource.AddNew()

    GondereninAdiSoyadiTextBox.Text = "Some text"
    GondereninAdresiTextBox.Text = "Some text"
    GondereninVergiNoTextBox.Text = "Some text"
    Label1.Visible = False

    MakbuzTBindingSource.EndEdit()

End Sub

http://www.vbforums.com/showthread.php?408692-RESOLVED-Add-Item-binding-source