Hi. I am using VS2010, C++/CLI Windows Forms Application
I want (Choose Cell in DVG, edit it, press Enter, get MessageBox with new value)
Now I need event for KeyPress(I dont want messageBox appear everytime I type 1 symbol)
But when I press Enter, nothing happens (Event for Editing Cell just stops)
So I can call MessageBox everytime I type a single symbol into cell, but when I press Enter nothing happens
I want (Choose Cell in DVG, edit it, press Enter, get MessageBox with new value)
this->dataGridView1->EditingControlShowing += gcnew System::Windows::Forms::DataGridViewEditingControlShowingEventHandler(this, &Form1::dataGridView1_EditingControlShowing);This event occurs when I am entering "Cell edit mode"
Now I need event for KeyPress(I dont want messageBox appear everytime I type 1 symbol)
private: System::Void dataGridView1_EditingControlShowing(System::Object^ sender, System::Windows::Forms::DataGridViewEditingControlShowingEventArgs^ e) { TextBox^ txtbx = (TextBox^)e->Control; if (txtbx != nullptr) { txtbx->KeyDown += gcnew System::Windows::Forms::KeyEventHandler(this, &Form1::txtbx_KeyPressed); } }Now event for KeyPressed
private: System::Void txtbx_KeyPressed(System::Object^ sender, System::Windows::Forms::KeyEventArgs^ e) { if (e->KeyCode == System::Windows::Forms::Keys::Enter) { TextBox^ txtbx = (TextBox^)sender; MessageBox::Show(txtbx->Text); } }When I type single character into Cell value, I get through all events (f.e. I type intro cell 123, I come through txtbx_KeyPressed)
But when I press Enter, nothing happens (Event for Editing Cell just stops)
So I can call MessageBox everytime I type a single symbol into cell, but when I press Enter nothing happens