I want to set the dataSource property for a pre-defined combobox within a dataGridView. How do I reference the dataSource at runtime so I can populate the combobox values with the values I want? I have actually created a DataGridViewComboBoxColumn within my code and set the dataSource on that to my dataTable containing my combobox values, but I don't know how to assign the value of my DataGridViewComboBoxColumn to my existing combobox within my DataGridView.
So, for example, I have a dataGridView called myDGV. Say it contains two columns...The first is a dataGridViewTextBoxColumn and the second is a dataGridViewComboBoxColumn. I have a dataTable defined as follows that I want to assign
The data table (dataTab) contains the value (ID) and display (Name) members I want associated with my combobox. How do I assign dataTab to myDGV's combobox?
Hopefully that makes sense. I would think this is a pretty straight forward thing to do but I can't seem to find any information on how to do this.
So, for example, I have a dataGridView called myDGV. Say it contains two columns...The first is a dataGridViewTextBoxColumn and the second is a dataGridViewComboBoxColumn. I have a dataTable defined as follows that I want to assign
Code:
Dim dataTab as New DataTable("comboTabValues")
dataTab.Columns.Add("ID")
dataTab.Columns.Add("Name")
The data table (dataTab) contains the value (ID) and display (Name) members I want associated with my combobox. How do I assign dataTab to myDGV's combobox?
Hopefully that makes sense. I would think this is a pretty straight forward thing to do but I can't seem to find any information on how to do this.