1
我想根據ToolStripComboBox中的選擇來填充TableAdapter。 首先,我想通過將ToolStipComboBox綁定到數據源來填充ToolStipComboBox。然後一旦填滿,我想填充TableAdapter。從綁定工具中填充TableAdapterStripComboBox
這是我的代碼:
Private Sub ToolStripComboBox_MessageType_Click(sender As Object, e As EventArgs) Handles ToolStripComboBox_MessageType.Click
Me.ToolStripComboBox_MessageType.ComboBox.DataSource = DataSet_UToolDb.XML_MESSAGE_TYPE
Me.ToolStripComboBox_MessageType.ComboBox.DisplayMember = "MessageType"
Me.ToolStripComboBox_MessageType.ComboBox.ValueMember = "MTId"
End Sub
Private Sub ToolStripComboBox_MessageType_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ToolStripComboBox_MessageType.SelectedIndexChanged
Me.TableAdapter_XML_MESSAGE_STRUCTURE.Fill(DataSet_UToolDb.XML_MESSAGE_STRUCTURE, Me.ToolStripComboBox_MessageType.ComboBox.SelectedValue)
End Sub
出於某種原因(如果我通過代碼步驟)的代碼從那裏數據源設置的跳躍,到TableAdapter的填充。這是因爲TableAdapter的select查詢正在根據從ToolStipComboBox中選擇的值查找值而導致異常。