All that is written in the function:
private: System::Void textBox1_KeyPress(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e) { char number = e.KeyChar; } It produces errors:
eexpression must have class typeC2228 expression to the left of
.KeyCharshould represent a class, structure, or union.
What is the mistake?
Replacing e.KeyChar with e->KeyChar helped, only now a new problem with
private: System::Void textBox1_KeyPress(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e) { char number = e->KeyChar; if (!Char.IsDigit(number)) { e->Handled = true; } } Complains if (!Char.IsDigit(number))