-
November 7th, 2013, 06:32 AM
#1
[RESOLVED] How to change DataGridView ComboBoxColumn-as TextBoxCell-in SelectedIndex ?
Hi
From the below codes, I have DataGridViewComboBox Column...ReligionClm...
and have a dataRow text "Add New Item"...
My intention is, while the user select other rows, then no problem. But, once the user
select "Add New Item" then the ComboBox need to change it as TextBoxCell...to read the new item.
I tried from ComboBox_SelectedIndex() I have not succeeded... Any changes with my code will be great
Form_Load(){
DataGridViewComboBoxColumn^ ReligionClm = gcnew DataGridViewComboBoxColumn();
this->myDataGrid1->Columns->Remove("religion");
this->myDataGrid1->Columns->Insert(5, ReligionClm);
this->myDataGrid1->Columns[5]->Name = "religion";
}
System::Void MyDataGrid1_EditingControlShowing() {
ComboBox^ ComBox = dynamic_cast<ComboBox^>(e->Control);
ComBox->SelectedIndexChanged += gcnew EventHandler(this, &Form_Form1::EmpCmb_SelectedIndexChanged);
}
System::Void EmpCmb_SelectedIndexChanged() {
if (myDataGrid1->CurrentRow->Cells["religion"]->Value=="Add New Item"){
DataGridViewTextBoxCell^ TxtBoxCell = gcnew DataGridViewTextBoxCell();
myDataGrid1[5, myDataGrid1->CurrentCell->RowIndex] = TxtBoxCell;
??????????? Any Chnages will be helpful....
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|