Динамическое создание столбцов и добавление строк в datagridview
Hello All, i have a query regarding add rows dynamically in datagridview .I need to have a datagridview which contains 4 columns as follows: Column headers : Test1 ,Test2, Test3, Test4 (Creation of columns is also dynamic) Test1 ,Test2 and Test3 are of type DataGridViewComboBoxColumn and Test4 of type DataGridViewTextBoxColumn Example: Suppose i have 4 rows in datagridview everytime the 1 and last row(4) under Test1 should have combo box items same and 2nd and 3rd have same data Test1 Test2 Test3 Test4 items(1,2) items(5,5) items(6,7) first items(4,5) items(5,5) items(6,7) first items(4,5) items(5,5) items(6,7) first items(1,2) items(5,5) items(6,7) first Please help me in this regard. Thanks & Regards, Sampath
Что я уже пробовал:
'DataGridView1.Строк.Добавить()
'Dim cmb как новый DataGridViewComboBoxColumn()
'Dim cmb1 как новый DataGridViewComboBoxColumn()
'Dim cmb2 как новый DataGridViewComboBoxColumn()
'Dim txtbox As New DataGridViewTextBoxColumn()
'Dim cmbOthers As New DataGridViewComboBoxColumn()
'Для i = от 0 до 3
- cmb.HeaderText = " Выбрать Данные"
- cmb.Имя = " cmb"
'cmb. MaxDropDownItems = 4
- cmb.Предметы.Добавить("1/3")
- cmb.Предметы.Добавить("1/2")
'DataGridView1.Столбцы.Добавить (cmb)
- cmb1.HeaderText = " Select Data1"
- cmb1.Имя = " cmb1"
'cmb1. MaxDropDownItems = 4
- cmb1.Предметы.Добавить("Правда")
- cmb1.Предметы.Добавить("Ложные")
'DataGridView1.Столбцы.Добавить (cmb1)