Click here to Skip to main content
15,895,777 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i have a DataTreeListView.I want to edit items. In editing on of the cells should cast to ComboBox.

when i write
C#
private void dataTreeListView1_CellEditStarting(object sender, CellEditEventArgs e)
        {
ComboBox responsiblePersonNameCombo = (ComboBox)e.Control;

}

vs got error:
casting TextBox to ComboBox is invalid!

i dont know what to do!
Posted
Updated 6-Jan-13 2:55am
v2

casting TextBox to ComboBox is invalid!
Error is quite straight forward and self explanatory.
e.Control is of datatype Textbox and thus when you try to cast into Combobox, you get the error.
 
Share this answer
 
Comments
Espen Harlinn 6-Jan-13 9:22am    
5'ed!
Simply try to change Dropdown behavior of your dropdown :
C#
private void dataTreeListView1_CellEditStarting(object sender, CellEditEventArgs e)
{
    comboBox1.DropDownStyle = ComboBoxStyle.Simple;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900