Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net VB 2019-从另一个表填充DataGridView中未绑定的列_Vb.net_Visual Studio - Fatal编程技术网

Vb.net VB 2019-从另一个表填充DataGridView中未绑定的列

Vb.net VB 2019-从另一个表填充DataGridView中未绑定的列,vb.net,visual-studio,Vb.net,Visual Studio,因此,我知道可以只使用数据适配器和源来设置未绑定的列,该列由链接引用表中的特定值填充,但由于某些原因,它对我不起作用 我还需要为未绑定列clientReference设置什么其他值 Public Class frmClientQuery Private Sub clientsBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles clientsBindingNavigatorSaveItem.Click

因此,我知道可以只使用数据适配器和源来设置未绑定的列,该列由链接引用表中的特定值填充,但由于某些原因,它对我不起作用

我还需要为未绑定列clientReference设置什么其他值

Public Class frmClientQuery
Private Sub clientsBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles clientsBindingNavigatorSaveItem.Click
    Me.Validate()
    Me.clientsBindingSource.EndEdit()
    Me.TableAdapterManager.UpdateAll(Me._30461723DataSet)

End Sub

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    'TODO: This line of code loads data into the '_30461723DataSet.clientReferences' table. You can move, or remove it, as needed.
    Me.ClientReferencesTableAdapter.Fill(Me._30461723DataSet.clientReferences)
    'TODO: This line of code loads data into the '_30461723DataSet.clients' table. You can move, or remove it, as needed.
    Me.clientsTableAdapter.Fill(Me._30461723DataSet.clients)

    clientReference.DataPropertyName = "clientReferences.description"

End Sub End Class
数据表:

执行:

你走错了方向。它不应该是一个未绑定的列。它应该是
clientReferenceID
外键列的绑定列。您应该将其设置为组合框列,然后将第二个
数据表
绑定到该列,以便显示
说明
列值。请参阅以了解如何操作。如果在设计器中将表适配器等添加到表单中,则可以在那里进行设置。只需编辑网格的列并更改最后一列的类型。然后,您可以根据需要设置列的
DataSource
DataMember
DisplayMember
ValueMember
属性。@jmchilney请添加这些作为答案。如此容易和快速地解决:)我的意见是宽泛地构成我认为是一个有效的答案。你应该写下你自己的答案,根据我的一般评论详细说明你所做的事情。