Prev: adding combobox item data
Next: form Unload
From: Moshazu on 21 Dec 2005 10:15 I am attempting to use the DataGridView control in my software and have not been able to easily find answers to a couple of questions that I have. 1. Is the only way to change the data in a DataGridViewComboBox during the runtime the way that I have done it here? If not, is there an easier way? Dim tmpCMBRow As New DataGridViewRow tmpCMBRow.CreateCells(Me.grid) tmpCMBRow.Cells(0).Value = "New Hello" Dim tmpCMBCell As New DataGridViewComboBoxCell tmpCMBCell.Items.AddRange(New String() {"tmp1", "tmp2", "tmp3"}) tmpCMBRow.Cells.RemoveAt(1) tmpCMBRow.Cells.Insert(1, tmpCMBCell) Me.grid.Rows.RemoveAt(0) Me.grid.Rows.Insert(0, tmpCMBRow) 2. Once I have my information in the DataGridViewComboBoxCell, how do I change the selected index of the information? I.E. in my example above using the tmp tags, how would I tell the grid to display tmp2 as the default when this cell is shown? Any help would be great. Thanks again all, and have a great holiday, Darian
|
Pages: 1 Prev: adding combobox item data Next: form Unload |