VB.Net 2013如何以编程方式更新bindingsource,而不会收到延迟绑定错误/警告?

VB.Net 2013如何以编程方式更新bindingsource,而不会收到延迟绑定错误/警告?,vb.net,visual-studio-2013,data-binding,bindingsource,late-bound-evaluation,Vb.net,Visual Studio 2013,Data Binding,Bindingsource,Late Bound Evaluation,我使用DataTable&TableAdapter创建了一个数据集,其中包含与我的MSSQL数据库相关的Select/Update/Insert/Delete命令。DataTable从Person表中选择所有字段(两个字段,特别是LastName字符串和UpdateUserID int) 然后我用一个文本框和一个按钮制作了一个简单的测试表单。从数据源选项卡,我将LastName字段拖到表单上。这将在表单上创建MyDataset、MyTableAdapter和MyBindingSource。它还将

我使用DataTable&TableAdapter创建了一个数据集,其中包含与我的MSSQL数据库相关的Select/Update/Insert/Delete命令。DataTable从Person表中选择所有字段(两个字段,特别是LastName字符串和UpdateUserID int)

然后我用一个文本框和一个按钮制作了一个简单的测试表单。从数据源选项卡,我将LastName字段拖到表单上。这将在表单上创建MyDataset、MyTableAdapter和MyBindingSource。它还将文本框数据绑定到BindingSource的LastName字段

以下是表单的完整代码:

Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        loadData()
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Me.Validate()
        Me.MyBindingSource.EndEdit()
        ' Me.MyBindingSource.Current("updateUserID") = 123
        Me.MyTableAdapter.Update(Me.MyDataset.myDatatable)
        loadData()
    End Sub

    Private Sub loadData()
        Me.MyTableAdapter.Fill(Me.MyDataset.myDatatable)
    End Sub

End Class
这一切都很好。当我取消注释行:“Me.MyBindingSource.Current(“updateID”)=123”时,就会出现问题。我正在尝试设置UpdateID以保存最近进行更改的用户的ID

在VisualStudio2008中,这很好地工作。但我刚刚升级到2013年,现在我得到一个错误,上面写着“Option Strict On disallows late binding”

(顺便说一句,这是一个测试程序。在实际的程序中-从2008年转换过来-我只收到警告说“延迟绑定解析;可能发生运行时错误”。)

我理解为什么会出现这些错误/警告:因为IDE不知道“updateUserID”数据列是什么数据类型

但是在保存之前,如何手动更新BindingSource?我不认为关闭选项是个好主意

DataTable中的DataColumns指定了其数据类型。有没有办法直接引用DataColumn而不是通过其名称的字符串

我要找的东西是:

Me.MyBindingSource.Current.DataColumns.UpdateUserID.value = 123
谢谢你的帮助