danasegarane
Active member
- Joined
- Jun 14, 2006
- Messages
- 41
- Programming Experience
- Beginner
Dear All,
Now I have code this to display the combo box in a datagrid.But I am not able to edit the combo values.How can I add the entered values in the combobox to the item collection.I am using this code
Now I have code this to display the combo box in a datagrid.But I am not able to edit the combo values.How can I add the entered values in the combobox to the item collection.I am using this code
VB.NET:
ngrid = New DataGridView
ngrid.Name = sname
nGrid.Visible = True
ngrid.Location = New Point(275, 32)
ngrid.Width = 244
ngrid.Height = 160
AddHandler nGrid.Click, AddressOf ngrid_Click
Me.Controls.Add(nGrid)
nGrid.Rows.Clear()
If dtCombo.Rows.Count > 0 Then
nGrid.EditMode = DataGridViewEditMode.EditOnEnter
nGrid.AutoGenerateColumns = False
nGrid.Columns.Add("col0", "Attribute")
nGrid.Columns.Add("col1", "Value")
For x As Long = 0 To dtCombo.Rows.Count - 1
Dim xedit As String = String.Empty
Dim i As Integer = nGrid.Rows.Add
xedit = nz((dtCombo.Rows(x)(3)).ToString)
Dim cmbcombocol As New DataGridViewComboBoxCell
cmbcombocol.Items.AddRange((dtCombo.Rows(x)(2)).ToString.Split(";"))
Dim atxt As New DataGridViewTextBoxCell
atxt.Value = nz((dtCombo.Rows(x)(1)).ToString)
ngrid.Rows(i).Cells(0) = atxt
nGrid.Rows(i).Cells(1) = cmbcombocol
ngrid.Columns(0).ReadOnly = True
If xedit.ToString.ToLower = "y" Then
cmbcombocol.ReadOnly = False
Else
cmbcombocol.ReadOnly = False
End If
Next
End If