datagridview ?
-
greeting again friends, i again need your help... as always it's badly needed... my problem is, when i change the column type into a comboboxcolumn i can only change it from design time.. 1.) how to change the columns using datagridview into a comboboxcolumn at runtime? 2.) how to populate the comboboxcolumn at runtime? from codes... links/ site/codes are highly appreciated... thank you.. :-D
start a new beginning in every ending; thats what life for......
-
greeting again friends, i again need your help... as always it's badly needed... my problem is, when i change the column type into a comboboxcolumn i can only change it from design time.. 1.) how to change the columns using datagridview into a comboboxcolumn at runtime? 2.) how to populate the comboboxcolumn at runtime? from codes... links/ site/codes are highly appreciated... thank you.. :-D
start a new beginning in every ending; thats what life for......
moomoooomoo wrote:
1.) how to change the columns using datagridview into a comboboxcolumn at runtime?
Create your own columns instead of relying on the designer to do it for you. You can't "modify" an exsting column. It has to be removed and replaced by one your code creates.
moomoooomoo wrote:
2.) how to populate the comboboxcolumn at runtime? from codes...
That depends on where the data is comming from that your trying to populate it with. Is it from a table in the database?? From a file?? Some data you have hard-coded?? Without further information, this[^] is about the best anyone can tell you.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
moomoooomoo wrote:
1.) how to change the columns using datagridview into a comboboxcolumn at runtime?
Create your own columns instead of relying on the designer to do it for you. You can't "modify" an exsting column. It has to be removed and replaced by one your code creates.
moomoooomoo wrote:
2.) how to populate the comboboxcolumn at runtime? from codes...
That depends on where the data is comming from that your trying to populate it with. Is it from a table in the database?? From a file?? Some data you have hard-coded?? Without further information, this[^] is about the best anyone can tell you.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007the data should come from sql database...
start a new beginning in every ending; thats what life for......
-
the data should come from sql database...
start a new beginning in every ending; thats what life for......
Create a second DataTable object with the ID's and Data of the items that are going to appear in the ComboBoxColumn. Then create a new DataGridViewComboBoxColumn and bind it to this table.
' Retrieve the data for the combobox Dim DataForCombo As DataTable = SQLStuff.GetDate() ' Create a new ComboBox column Dim col As New DataGridViewComboBoxColumn With col .HeaderText = "Column Header in DGV" .DataPropertyName = "_ID column name in the table the DGV is showing_" .DataSource = DataForCombo .ValueMember = "_ID column name in DataForCombo table_" .DisplayMember = "_Column name for the data shown to the user in the ComboBox_" End With DataGridView1.Columns.Add(col)
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007