Windows Develop Bookmark and Share   
 index > Windows Forms Designer > ComboBox Cell
 

ComboBox Cell

Hi I have a dataGridView In which i have to do one thing

If user click opn any cell then a combo should appear there and user can select any thing from that and after this it should be disable

for this i have done some lines on code.

Dim l_ComboCell As New DataGridViewComboBoxCell

Dim l_rowPosition = dgvReport.CurrentCellAddress.X


Private Sub dgvReport_EditingControlShowing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles dgvReport.EditingControlShowing

Try

editingComboBox =

CType(e.Control, ComboBox)

If Not editingComboBox Is Nothing Then

Catch ex As Exception

'...

End Try

End Sub

Private Sub editingComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

Dim l_strPrimaryKey As String = ""

D

im l_intSelectedIndex As Integer = 0

Try

' MessageBox.Show(editingComboBox.SelectedValue)

'l_strEditedValue = dgvReport.Rows(dgvReport.CurrentCell.RowIndex).Cells(dgvReport.CurrentCell.ColumnIndex).EditedFormattedValue.ToString

'l_intSelectedIndex = editingComboBox.FindString(l_strEditedValue)

'editingComboBox.SelectedIndex = l_intSelectedIndex

R

End Sub My problem is that when i select some thing from this combo box then its selected value is displaying in combo box.

My problem is that when i select some thing from this combo box then its selected value is displaying in combo box.

emoveHandler editingComboBox.SelectedIndexChanged, AddressOf editingComboBox_SelectedIndexChanged Catch ex As Exception End Try
End If
If Not editingComboBox.SelectedValue Is Nothing Then
Dim l_strEditedValue As String = ""

AddHandler editingComboBox.SelectedIndexChanged, AddressOf editingComboBox_SelectedIndexChanged End If

how can i solve this it menas , suppoese i have seleted a nema then it is displaying the name number aftyer selection

Progress2007  Saturday, May 16, 2009 6:57 AM
Hi Progress2007,

Would you please format the code and clarify what you are trying to accomplish? For now, I am not sure what you are trying to do.


Best regards,
Bruce Zhou
Please mark the replies as answers if they help and unmark if they don't.
Bruce.Zhou  Monday, May 18, 2009 2:24 AM
in datagridviewcomboboxcell when u select a name and leave the control it will display its value. all u need to remvoe the combobox.valuemember during binding. dont know whether there is another way or not
Binil MB  Monday, May 18, 2009 6:52 AM

You can use google to search for other answers

Custom Search

More Threads

• Validating all controls on Form
• Designer errors
• Treeview control
• C# Listbox control from other forms
• Designer cannot be shown VC++ 2005
• How to set readonly for property with return value of collection.
• Problem with refreshing parameter collection in designer mode
• Usercontrol inheritance stopped working in designer (VS 2005)
• Obtain the control beneath the cursor
• Floating toolbar interface